===== Test Pprogram ===
#include <iostream>
using namespace std;
struct S {
int a;
int b;
};
class C {
public:
int a;
int b;
};
class CF {
public:
int a;
int b;
void f1() {};
void f2() {};
void f3() {};
};
class CVF {
public:
int a;
int b;
virtual void f1() {};
virtual void f2() {};
virtual void f3() {};
};
int main(int argc, char** argv)
{
cout << "Size of struct S " << sizeof(struct S) << endl;
cout << "Size of class C " << sizeof(C) << endl;
cout << "Size of class CF " << sizeof(CF) << endl;
cout << "Size of class CVF " << sizeof(CVF) << endl;
return 0;
}
==== Result ====
Size of struct S 8
Size of class C 8
Size of class CF 8
Size of class CVF 12