mardi 22 septembre 2020

Resolving link error with diamond problem

ALL,

class Base1
{
public:
    virtual void Foo();
};

class Base2
{
public:
    virtual void Foo();
};

class Derived : public Base1, public Base2
{
public:
    virtual void Foo();
};

void Derived::Foo()
{
    dynamic_cast<Base1 *>( this )->Foo();
}

When I added Derived::Foo(), I got the warning about hiding overloaded virtual function and then linking error.

What is the best way to fix the error?

Aucun commentaire:

Enregistrer un commentaire