Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Device {
  5. public:
  6. void turn_on() {
  7. cout << "Device is on." << endl;
  8. }
  9. };
  10.  
  11. class Computer: virtual public Device {};
  12.  
  13. class Monitor: virtual public Device {};
  14.  
  15. class Laptop: public Computer, public Monitor {};
  16.  
  17. int main() {
  18. Laptop Laptop_instance;
  19. Laptop_instance.turn_on();
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement