alias this ...

Stanislav Blinov stanislav.blinov at gmail.com
Mon Sep 6 14:07:52 PDT 2010


BLS wrote:
> On 06/09/2010 22:36, BLS wrote:
>> point3D = = new point3D(10,20,30) // Njet
>>      //etc
> 
> should be
> point3D p3 = new point3D(10,20,30) // Njet
> 
> 
> sorry

Struct is value type, not reference type like class. You don't need 
'new' to create it, just uncomment your constructor ('this') and remove 
'new':

point3D p3 = point3D(10,20,30);

If you really need to allocate a point on the heap, then you'd have to 
use pointers:

point3D* p3 = new point3D(10,20,30);

Though you probably wouldn't need that much.


More information about the Digitalmars-d-learn mailing list