Created
March 29, 2019 11:10
Star
You must be signed in to star a gist
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 Device { | |
public: | |
virtual void turn_on() = 0; | |
}; | |
class Laptop: public Device { | |
public: | |
void turn_on() { | |
cout << "Device is on." << endl; | |
} | |
}; | |
int main() { | |
Laptop Laptop_instance; | |
Laptop_instance.turn_on(); | |
// Device Device_instance; | |
// will cause compile time error | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment