Syntax for Pointer to Class

Q. Schroll qs.il.paperinik at gmail.com
Fri Jan 25 20:12:33 UTC 2019


Say I have a class C and I want a pointer to a C handle.

I tried the following pieces of syntax:

   C* obj = new C(); // gives me a C
   C* obj = new C*(); // gives me a C**
   C* obj = C*(); // refuses to compile

Is it even possible? This sounds so newbie...
I know it's fairly simple with structs: S() gives me a struct 
instance, new S() gives me a ptr to a struct instance.


More information about the Digitalmars-d-learn mailing list