Created
September 9, 2018 05:51
-
-
Save dibakarsutradhar/6b25fd27576cf7eb40d858e74a044296 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
// 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