Skip to content

Instantly share code, notes, and snippets.

@chichunchen
Created April 19, 2019 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chichunchen/4c7f052ed4ee64ebd145d3875fa8fc13 to your computer and use it in GitHub Desktop.
Save chichunchen/4c7f052ed4ee64ebd145d3875fa8fc13 to your computer and use it in GitHub Desktop.
#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