Detemining the size of a Class Object
There are many factors that decide the size of an object of a class in C++. These factors are:
- Size of all non-static data members
- Order of data members
- Byte alignment or byte padding
- Size of its immediate base class
- The existence of virtual function(s) (Dynamic polymorphism using virtual functions).
- Compiler being used
- Mode of inheritance (virtual inheritance)
Comments
Post a Comment