Skip to content

Instantly share code, notes, and snippets.

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