#include <iostream>
using namespace std;
struct A
{
void foo() { cout << "A::foo()\n"; }
};
struct B : virtual A
{
virtual void foo() { cout << "B::foo()\n"; }
};
struct C : B, virtual A
{
void foo() { cout << "C::foo()\n"; }
};
int main (int argc, char *argv[])
{
C().foo();
A *a = new C; a->foo();
static_cast<A*>(new C)->foo();
return 0;
}
Login in to like
Login in to comment