Get address of object in constructor.

MGW via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 13 08:43:02 PDT 2016


I want to get address of object Cfoo in constructor. Whether it 
is possible?

now:
-------------
class Cfoo {
	void* adrThis;
	void saveThis(void* adr) {	adrThis = adr; }
}
...
Cfoo foo = new Cfoo(); foo.saveThis(&foo);

shall be
--------------
class Cfoo {
	void* adrThis;
	this() {
		adrThis = ?????????
	}
}
...
Cfoo foo = new Cfoo();



More information about the Digitalmars-d-learn mailing list