Re: Getting the address of the class object

2010-01-11 Thread Ali Çehreli
bearophile wrote: 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 =

Re: Getting the address of the class object

2010-01-11 Thread bearophile
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

Getting the address of the class object

2010-01-11 Thread Ali Çehreli
Coming from C++, I wonder whether it is ever needed to get the address of the object? If so, how? The & operator below produces the address of the class reference (variable). How about the class object? class C {} void main() { auto variable = new C; auto address = &variable; } Than