--------------------------------
一、“倒三角”二义性问题-------------------------------
问题描述:卤煮之所以称之为“倒三角问题”,是因为这一类二义性问题所处的继承体系类似于倒三角形状,如图:
这样,在子类中就存在父类A、B的两份show(),在调用的时候就会出现二义性问题,这种问题该怎么解决呢?
面对问题:
//下面这种情况出现的二义性怎么解决?
/*
class grandpa
{
public:
void show()
{
cout<<"This is grandpa\n";
}
};
class father
{
public:
void show()
{
cout<<"This is father\n";
}
};
class son:virtual public grandpa,virtual public father
{
public:
void display()
{
c
/*
class grandpa
{
public:
void show()
{
cout<<"This is grandpa\n";
}
};
class father
{
public:
void show()
{
cout<<"This is father\n";
}
};
class son:virtual public grandpa,virtual public father
{
public:
void display()
{
c