Skip to content

Instantly share code, notes, and snippets.

@kateolenya
Created March 29, 2019 11:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kateolenya/7d24f1ec8450620c86974ca6bc647670 to your computer and use it in GitHub Desktop.
#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