Pointer to Object Questions

John Kiro johnkirollos at yahoo.com
Mon Jan 1 04:47:09 PST 2007


Thanks guys for all your comments.. I've found them invaluable in
this tricky part of my D language exploration :-)

As a summary:

- CObj obj2=obj1;

    obj2 is a reference to obj1 (both obj1 & obj2 refer to the same
object). So no new object is created.

- CObj* pRefObj1=&obj1;

    pRefObj1 is the address of the reference of the object, not a
pointer to the object itself.. TAKE CARE!

- void* pObj1=cast(void*)obj1;

    pObj1 is a pointer to the object itself (as object pointers in
C++)


Happy New Year
John


More information about the Digitalmars-d-learn mailing list