1. 程式人生 > >含有虛擬函式的C++類大小

含有虛擬函式的C++類大小

#include <iostream>
using namespace std;

class Test1{
virtual void func1(){}
virtual void func2(){}
public:
virtual ~Test1();
};

class Test2{
virtual void func2(){}
};

class SonOfTest1:public Test1{
virtual void func2(){}
virtual void func3(){}
};

class SonOfTest1Test2:public Test1,public Test2{
virtual void func4(){}
};

int main()
{
cout<<"sizeof(Test1):"<<sizeof(Test1)<<endl;