safari比chrome beta色彩好?# Apple - 家有苹果
l*y
1 楼
If you inherit a base class as virtual, only one subobject of that class
will ever appear as a base class. 下面这个例子:
#include
#include
using namespace std;
class MBase {
public:
int i_base;
virtual char* vf() const = 0;
virtual ~MBase() {}
};
class D1 : virtual public MBase {
public:
char* vf() const { return "D1"; }
};
class D2 : virtual public MBase {
public:
char* vf() const { return "D2"; }
};
// MUST explicitly disambiguate vf():
class MI : public D1, public D2 {
will ever appear as a base class. 下面这个例子:
#include
#include
using namespace std;
class MBase {
public:
int i_base;
virtual char* vf() const = 0;
virtual ~MBase() {}
};
class D1 : virtual public MBase {
public:
char* vf() const { return "D1"; }
};
class D2 : virtual public MBase {
public:
char* vf() const { return "D2"; }
};
// MUST explicitly disambiguate vf():
class MI : public D1, public D2 {