Get address of object in constructor.
MGW via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Mar 13 08:59:02 PDT 2016
On Sunday, 13 March 2016 at 15:49:20 UTC, WebFreak001 wrote:
> On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote:
>> I want to get address of object Cfoo in constructor. Whether
>> it is possible?
>
> class Cfoo {
> void* adrThis;
> this() {
> adrThis = cast(void*) this;
> }
> }
> ...
> Cfoo foo = new Cfoo();
>
> "this" should work
>
> (pun intended)
Super! Ok!
More information about the Digitalmars-d-learn
mailing list