Struct vs Class
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Sun Dec 10 20:55:12 PST 2006
Derek Parnell wrote:
> Have I got the difference between Class and Struct right? Have I missed
> anything?
>
> Functionality Class Struct
> --------------------------------------------------
> Default instantiation :: Heap Stack
> Constructor :: this() void opCall()
> Destructor :: ~this() None
> Argument passing :: by Reference by Value
> Assignment :: Reference Value
> bit copy bit copy
> Inheritance :: Single None
> Interfaces :: Multiple None
> Order of data members :: Defined by Defined by
> in RAM compiler coder
> -------------------------------------------------
Overridable (virtual) functions: yes/no. Unless that's self-understood
under "inheritance".
Lockable (can be the target of "synchronized"): yes/no.
Andrei
More information about the Digitalmars-d-learn
mailing list