Pointer to Object Questions

BCS nothing at pathlink.com
Sat Dec 30 09:11:32 PST 2006


%u wrote:
> Hello Everybody
> 
> I'm trying to understand how to get pointers working in D, so I wrote
> this example, and still several questions are without answer. Can
> somebody take a look on the code below, and comment on the 3
> questions in the output section? My main problem is with expressions
> in the form "MyClass* pObj".
> 
> Thanks and Happy New Year
> John
> 
First thing first (and this is a common gotcha) All objects are accessed 
by reference.

class Foo{}

Foo* f;	// this is a pointer to a reference (pointer) to an object
Foo g; // this is a reference to an object

regular types are not

int* p; //pointer to int


More information about the Digitalmars-d-learn mailing list