#include <iostream> using namespace std; class Device { public: void printType(){printf("Generic Device\n");} }; class Sensor : public Device{ public: void printSensor(){printf("Sensor Device\n");} }; int main() { Sensor s; s.printType(); // inherited method s.printSensor(); // derived method return 0; }
Test Cases
Test Results
Input
Expected Output
Generic Device Sensor Device