Created
March 28, 2019 12:31
-
-
Save kateolenya/5c229eb25f3deb8a44a6e7dc94b0af2e to your computer and use it in GitHub Desktop.
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 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