Hello everyone,
The following code will result in compile error below is because of private method of base class is also considered into name lookup, even if we can not access directly the private method of base class?
error C2385: ambiguous access of 'foo'
thanks in advance,
George
The following code will result in compile error below is because of private method of base class is also considered into name lookup, even if we can not access directly the private method of base class?
error C2385: ambiguous access of 'foo'
Code:
class Base
{
private:
void foo() {}
public:
void bar() {}
};
struct Mixin { void foo() {} };
class Derived: public Base, public Mixin
{
public:
void bar() { foo(); } // Uh oh.
};
int main()
{
Derived().bar();
}
thanks in advance,
George