Skip to content

Instantly share code, notes, and snippets.

@kateolenya
Created March 28, 2019 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kateolenya/5c229eb25f3deb8a44a6e7dc94b0af2e to your computer and use it in GitHub Desktop.
Save kateolenya/5c229eb25f3deb8a44a6e7dc94b0af2e to your computer and use it in GitHub Desktop.
#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