Skip to content

Instantly share code, notes, and snippets.

@dibakarsutradhar
Created September 9, 2018 05:51
Show Gist options
  • Save dibakarsutradhar/6b25fd27576cf7eb40d858e74a044296 to your computer and use it in GitHub Desktop.
Save dibakarsutradhar/6b25fd27576cf7eb40d858e74a044296 to your computer and use it in GitHub Desktop.
// Example program
#include <iostream>
using namespace std;
class Base {
public:
virtual void show() {
cout << "Base Class" << endl;
}
};
class Derived : public Base {
public:
void show() {
cout << "Derived Class" << endl;
}
};
int main(void) {
Base *bp = new Derived;
bp -> show(); // Run-Time Polymorphism
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment