An object is the size of its members. Plus all objects of a class share the methods of that class. Plus possible padding bytes (don't know about that one, but C sometimes does that for structs and unions, to align the data on word boundaries. I guess c++ does the same, but I don't know).
sizeof returns the size of the parameter. I think sizeof for an object returns the dynamic size of that instance. i.e. not counting the methods it shares with other objects of that class.
Also, what's the lifetime of a member variable of derived type when created as a side effect of implicit (automatic?) instantiation in a function call variable declaration? You are correct. Structure members are generally aligned to "natural" boundaries. A 64 bit long to a 64 bit boundary, a 32 bit int to a 32 bit boundary, a double to its natural boundary. This is critically important on RISC processors as the fetching of these on an odd boundary causes a
On Mon, 7 Apr 2003 17:38:33 +0200
Anders Johansson