Hi guys,
I know this is more a question for C++ in general, but I first want your judgment.
The example below shows my problem. In class C, I get an ambiguity error with parameter i.
According to the c++11 standard this should not be the case in the shown example.
GCC, Clang and Codan all tell me different though.
Am I getting something wrong here? What do you think?
thanks Michi
>>> EXAMPLE >>>
class A {
protected:
int i = 0;
};
class B : private A {
private:
int getValue() {
return i;
}
};
class C : private A, public B {
private:
int getValue() {
return i;
}
};
<<< EXAMPLE <<<
>>> ISO/IEC 14882:2011 >>>
[....] 11.2 Accessibility of base classes and base class members [class.access.base]
If a class is declared to be a base class (Clause 10) for another class using the public access specifier, the
public members of the base class are accessible as public members of the derived class and protected
members of the base class are accessible as protected members of the derived class. If a class is declared to
be a base class for another class using the protected access specifier, the public and protected members
of the base class are accessible as protected members of the derived class. If a class is declared to be a base
class for another class using the private access specifier, the public and protected members of the base
class are accessible as private members of the derived class. [....]
|