返回信息流#include <iostream>
using namespace std;
class AA
{
public:
int i;
virtual void fun(){}
};
class BB : public AA
{
public:
int j;
};
class CC : public AA
{
public:
int k;
};
class DD :public BB,public CC
{
};
int main()
{
cout << "sizeof(AA):" << sizeof(AA) << endl; //8
cout << "sizeof(BB):" << sizeof(BB) << endl; //12
cout << "sizeof(CC):" << sizeof(CC) << endl; //12
cout << "sizeof(DD):" << sizeof(DD) << endl; //24
}
在不采用虚继承的情况下结果如上述,难道多继承里面有两个vptr?
这是一条镜像帖。来源:北邮人论坛 / cpp / #16862同步于 2008/11/29
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
请教多继承虚函数的问题
zmsong
2008/11/29镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。