理想的菱形继承如图所示
#include "iostream"
using namespace std;
class top
{
public:
void baseshow()
{
cout << "baseshow" << endl;
}
};
class left:public::top
{
public:
void leftshow()
{
cout << "leftshow" << endl;
}
};
class right:public::top
{
public:
void rightshow()
{
cout << "rightshow" << endl;
}
};
class bottom:public left,public right
{
public:
void bottomshow()
{
}
};
int main()
{
bottom rlxy;
rlxy.bottomshow();
}
实际上的类型继承如图所示
通过查看代码,发现报错信息为基类有歧义
未完-晚上补上