D - more or less power than C++?

Andrew Fedoniouk news at terrainformatica.com
Sat Mar 4 10:07:24 PST 2006


>
> My suggestion is not to provide opAssign for classes. It is providing
> opAssign for structs.
>
> /Oskar

Exactly!
Classes and structures are conceptually different despite
of the fact that they share common notation.

I would suggest also to disable following:

struct mystruct {
   int myfield;
}

mystruct *pms = new mystruct;
mystruct ms;

pms.myfield = 1; // this must be an ERROR!
(*pms).myfield = 1; // this is OK
ms.myfield = 1; // this is OK






More information about the Digitalmars-d mailing list