Skip to content

Instantly share code, notes, and snippets.

@kris7t
Last active August 29, 2015 14:05
Show Gist options
  • Save kris7t/60c985c638bbf79b5628 to your computer and use it in GitHub Desktop.
Save kris7t/60c985c638bbf79b5628 to your computer and use it in GitHub Desktop.
#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