class A
{
protected:
string word;
};
class B
{
protected:
string word;
};
class Derived: public A, public B
{
};
How would the accessibility of the variable word
be affected in Derived
? How would I resolve it?
It will be ambiguous, and you'll get a compilation error saying that.
You'll need to use the right scope to use it:
class Derived: public A, public B
{
Derived()
{
A::word = "A!";
B::word = "B!!";
}
};
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments