Getting the address of the class object

bearophile bearophileHUGS at lycos.com
Mon Jan 11 15:54:59 PST 2010


Ali Çehreli Wrote:

> Coming from C++, I wonder whether it is ever needed to get the address 
> of the object? If so, how?

I've never had to do this in D. I think you can just cast the class reference to void* and then to the pointer you want, something like (untested):

Foo f = new Foo;
auto p = cast(something*)cast(void*)f;

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list