Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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
You can’t perform that action at this time.