Investigates diamond-shaped multiple inheritance - C++ Class

C++ examples for Class:Inheritance

Description

Investigates diamond-shaped multiple inheritance

Demo Code

#include <iostream>
using namespace std;
class A//w  ww  . j a v  a 2 s.  c  o  m
{
   public:
   virtual void func(){}
};
class B : public A
{  };
class C : public A
{  };
class D : public B, public C
{  };
int main()
{
   D objD;
   //objD.func();  //ambiguous: won't compile
   return 0;
}

Related Tutorials