L.S.
I am trying to learn how to program in C++. At the moment I work my way
trough B. Preiss his book on data structures. I run here into an
excersize which won't compile with g++. A dressed down version (in
reality both Base1 and Base2 inherit from the same class, so I have a
diamond in the inheritance diagram for example) is included below.
#include <iostream>
using namespace std;
class Base1 {
public:
virtual ~Base1() {}
virtual Base1& SomeFunc() =0;
};
class Base2 {
public:
virtual ~Base2() {}
virtual void DoSomething() {cout << "Hallo world\n";}
};
class Derived: virtual public Base1, virtual public Base2 {
public:
Derived& SomeFunc() {return *this;}