Write a program to find the size of a class.
#include<iostream> using namespace std; class A { private: int d; static int x; }; int A :: x = 10; int main() { A obj; cout << "Size of class A = " << sizeof(A) << endl; cout << "Size of obj = " << sizeof(obj) << endl; return 0; }
Output
Size of class A = 4 Size of obj = 4