Cc Dokumentation References Etc

class Interface
{
public:
    // one member for each derived class
    virtual void doSomething(ClassA & ob) = 0;
    virtual void doSomething(ClassB & ob) = 0;
    // ...
};

class Base
{
public:
    virtual void doSomething(Interface & cb) = 0;
};

class ClassA : public Base
{
public:
    virtual void doSomething(Interface & cb) { cb.doSomething(*this); }
};

class ClassB : public Base
{
public:
    virtual void doSomething(Interface & cb) { cb.doSomething(*this); }
};

class Client : public Interface
{
public:
    // again one member for each derived class
    virtual void doSomething(ClassA & ob) { /* ... */ }
    virtual void doSomething(ClassB & ob) { /* ... */ }
    // ...

    void doSomething(Base & ob) { ob.doSomething(*this); }
};