Ambiguous reference to base class - C++ Class

C++ examples for Class:Inheritance

Description

Ambiguous reference to base class

class Parent
{
   protected:
   int basedata;
};
class Child1 : public Parent
{ };
class Child2 : public Parent
{ };
class Grandchild : public Child1, public Child2
{
   public:
   int getdata()
   { return basedata; }   // ERROR: ambiguous
};

Related Tutorials