Created
August 2, 2019 11:15
-
-
Save den385/fe0082409ac9237d0fb26622e6ea4514 to your computer and use it in GitHub Desktop.
This file contains 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> | |
#include <string> | |
#include <vector> | |
class A | |
{ | |
private: | |
virtual void m1() = 0; | |
virtual void m2() { std::cout << "A base" << std::endl; } | |
}; | |
class B : public A | |
{ | |
private: | |
virtual void m1() = 0; | |
}; | |
class C : public B | |
{ | |
public: | |
virtual void m1() override final { std::cout << "overriden" << std::endl; } | |
virtual void m2() override final { std::cout << "A base overriden" << std::endl; } | |
}; | |
int main() | |
{ | |
C x; | |
x.m1(); | |
x.m2(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment