Struct vs Class

Derek Parnell derek at nomail.afraid.org
Sun Dec 10 20:13:35 PST 2006


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
-------------------------------------------------


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
11/12/2006 3:04:33 PM


More information about the Digitalmars-d-learn mailing list