Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Device {
- public:
- void turn_on() {
- cout << "Device is on." << endl;
- }
- };
- class Computer: virtual public Device {};
- class Monitor: virtual public Device {};
- class Laptop: public Computer, public Monitor {};
- int main() {
- Laptop Laptop_instance;
- Laptop_instance.turn_on();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement