Last active
August 29, 2015 14:05
-
-
Save kris7t/60c985c638bbf79b5628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class A { | |
public: | |
virtual ~A() { } | |
virtual void Foo() { | |
std::cout << "Hello from A!" << std::endl; | |
} | |
}; | |
class B : public virtual A { | |
public: | |
void Foo() override { | |
std::cout << "Hello from B!" << std::endl; | |
} | |
}; | |
class C : public virtual A, private virtual B { | |
}; | |
static void Bar(A &a) { | |
a.Foo(); | |
} | |
int main() { | |
C c; | |
// c.Foo(); | |
Bar(c); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment