#include<iostream> using namespace std; class Device { public: void showType() { cout<<"Generic Device"<<endl; } }; class Sensor: protected Device { public: void showSensor() { showType(); cout<<"Sensor Device"<<endl; } }; int main() { Sensor s1; s1.showSensor(); }
Test Cases
Test Results
Input
Expected Output
Generic Device Sensor Device