Confused about class equality

strtr strtr at spam.com
Fri Apr 2 22:03:40 PDT 2010


What I probably mean to ask is :
In the code below, for what kind of i1 and i2 would the output be like this :
---------
Same Value.
3 : 5B536C 59D020
3 : 59CE0C 59CEF0
5 : 5B536C 59D020
5 : 59CE0C 59CEF0
---------
if( i1 !is null && i2 !is null && i2.value == i1.value ) {
	writefln("Same Value.");
	if( i2 is i1 ) writefln("Same Object.");
	writefln( i2.toString()," : ",i2.__vptr," ",i2.__monitor);
	writefln( i1.toString(), " : ", i1.__vptr," ",i1.__monitor);
	i1.value = 5;
	writefln( i2.toString()," : ",i2.__vptr," ",i2.__monitor);
	writefln( i1.toString(), " : ", i1.__vptr," ",i1.__monitor);
}




More information about the Digitalmars-d-learn mailing list