#include <iostream> using namespace std; class PowerControl { public: void enable() { cout << "Power enabled" << endl; } }; class InterruptControl { public: void enable() { cout << "Interrupt enabled" << endl; } }; // Multiple inheritance class SpiDriver : public PowerControl, public InterruptControl { }; int main() { int mode; cin >> mode; SpiDriver spi; if(!mode){ spi.PowerControl::enable(); } else{ spi.InterruptControl::enable(); } return 0; }
Test Cases
Test Results
Input
0
Expected Output
Power enabled