#include <iostream> using namespace std; /* Base class*/ class Devvice { public: void printType() { cout << "Generic Device" << endl; } }; class Sensor : public Devvice { public: void printSensor() { cout << "Sensor Device" << endl; } }; int main(){ Sensor sensor; sensor.printType(); // Inherited method from Devvice sensor.printSensor(); // Method from Sensor return 0; }
Test Cases
Test Results
Input
Expected Output
Generic Device Sensor Device