Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Advertisement
Add Comment
Please, Sign In to add comment