class MyClass { public: void print() { cout << "print"; } void print2() { cout << "print2"; } private: //bool bT; //int data; //int data2; }; int main() { MyClass stackObj; MyClass* heapObj = new MyClass(); int classSize = sizeof(MyClass); /// outputs 1 int stackObjsize = sizeof(stackObj); /// outputs 1 int heapObjsize = sizeof(heapObj); /// outputs 4. why? return 0; }
heapObj
sizeof
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)