#include <iostream>
#include <string>
struct A {
void exec() {
std::cout << "Hello ";
}
};
struct B {
void exec() {}
};
struct C : virtual A, virtual B {
void exec() {
A::exec();
std::cout << "World\n";
}
};
int main() {
A* a = new C();
B* b = new C();
C* c = new C();
a->exec();
b->exec();
c->exec();
}
Login in to like
Login in to comment