Re: Syntax for Pointer to Class

2019-01-25 Thread rikki cattermole via Digitalmars-d-learn
On 26/01/2019 9:52 AM, Q. Schroll wrote:     C* ptr = &[ new C(...) ][0]; C* ptr = [ new C(...) ].ptr; Should work.

Re: Syntax for Pointer to Class

2019-01-25 Thread Q. Schroll via Digitalmars-d-learn
On Friday, 25 January 2019 at 20:31:29 UTC, H. S. Teoh wrote: On Fri, Jan 25, 2019 at 08:12:33PM +, Q. Schroll via Digitalmars-d-learn wrote: Say I have a class C and I want a pointer to a C handle. Note that taking the address of `C` will actually give you a pointer to the reference, not

Re: Syntax for Pointer to Class

2019-01-25 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 25, 2019 at 08:12:33PM +, Q. Schroll via Digitalmars-d-learn wrote: > 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*(); // refuse

Syntax for Pointer to Class

2019-01-25 Thread Q. Schroll via Digitalmars-d-learn
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