Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <iostream>
using namespace std;
class Computer {
private:
void turn_on() {
cout << "Computer is on." << endl;
}
};
class Monitor {
public:
void turn_on() {
cout << "Monitor is on." << endl;
}
};
class Laptop: public Computer, public Monitor {};
int main() {
Laptop Laptop_instance;
// Laptop_instance.turn_on();
// 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.