A
Author
I was browsing the MSDN class library for the Object class, and tested
its sample code.
If we have
Object o = null;
Object p = null;
Then
Object.ReferenceEquals(o, p);
will give me true. This seems to mean that o and p are both pointing
to the same object. Fair enough.
But, if we instantiate another Object q
Object q = new Object();
q = null;
Now,
Object.ReferenceEquals(o, q);
gives us false, although both o and q have a null value. This seems
to mean that o and q are pointing to different stuffs. The question
is, why when we do:
Object o = null;
Object p = null;
o and q seem to point to the same stuff?
I am not sure if I made my question clear.
its sample code.
If we have
Object o = null;
Object p = null;
Then
Object.ReferenceEquals(o, p);
will give me true. This seems to mean that o and p are both pointing
to the same object. Fair enough.
But, if we instantiate another Object q
Object q = new Object();
q = null;
Now,
Object.ReferenceEquals(o, q);
gives us false, although both o and q have a null value. This seems
to mean that o and q are pointing to different stuffs. The question
is, why when we do:
Object o = null;
Object p = null;
o and q seem to point to the same stuff?
I am not sure if I made my question clear.