Created
April 19, 2019 22:24
-
-
Save chichunchen/4c7f052ed4ee64ebd145d3875fa8fc13 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> | |
using namespace std; | |
class Base { | |
public: | |
// user wants to override this in | |
// the derived class | |
virtual void func() | |
{ | |
cout << "I am in base" << endl; | |
} | |
}; | |
class derived : public Base { | |
public: | |
// did a silly mistake by putting | |
// an argument "int a" | |
void func(int a) override | |
{ | |
cout << "I am in derived class" << endl; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment