Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Base {
- public:
- void doIt() {
- std::cout << "Base::doIt()" << std::endl;
- virtIt();
- }
- private:
- virtual void virtIt() = 0;
- };
- class Der: public Base {
- public:
- void tryThis() {
- std::cout << "Der::tryThis()" << std::endl;
- virtIt();
- }
- private:
- void virtIt() {
- std::cout << "Der::virtIt()" << std::endl;
- }
- };
- int main() {
- Der d;
- d.doIt();
- d.tryThis();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement