关于MFC编程的Ondraw()函数下的问题~~~
\\虚基类执行顺序~~~~表示搞不懂~~#include<iostream>usingnamespacestd;classbase1{public:base1(){cou...
\\虚基类执行顺序~~~~表示搞不懂~~
#include <iostream>
using namespace std;
class base1
{
public:
base1(){cout<<"class base1"<<endl;}
};
class base2
{
public:
base2(){cout<<"class base2"<<endl;}
};
class level1: public base1,public base2
{
public:
level1(){cout<<"class level1"<<endl;}
};
class level2:virtual public base1,public base2
{
public:
level2(){cout<<"class level2"<<endl;}
};
class leaf:virtual public base2,public base1
{
public:
leaf(){cout<<"class leaf"<<endl;}
};
int main()
{
level1 ohmygod;
return 0;
}
完全不懂运行顺序~~~ 虚基类本来就不太懂~~~ 求教育呀~ 展开
#include <iostream>
using namespace std;
class base1
{
public:
base1(){cout<<"class base1"<<endl;}
};
class base2
{
public:
base2(){cout<<"class base2"<<endl;}
};
class level1: public base1,public base2
{
public:
level1(){cout<<"class level1"<<endl;}
};
class level2:virtual public base1,public base2
{
public:
level2(){cout<<"class level2"<<endl;}
};
class leaf:virtual public base2,public base1
{
public:
leaf(){cout<<"class leaf"<<endl;}
};
int main()
{
level1 ohmygod;
return 0;
}
完全不懂运行顺序~~~ 虚基类本来就不太懂~~~ 求教育呀~ 展开
2010-12-03
展开全部
虚基类,顾名思义,虚的 不是这个类的,在其他类中定义的
使用的时候继承类中需要重新构造才能使用
使用的时候继承类中需要重新构造才能使用
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询