#include <iostream>
using namespace std;

class Device {
public:
	// Implement void printType() to print "Generic Device"
	void printType() {
		cout << "Generic Device" << endl;
	}
};

	// Define class Sensor inheriting publicly from Device
class Sensor : public Device {
public:				
   // Implement void printSensor() to print "Sensor Device"
   void printSensor() {
      cout << "Sensor Device" << endl;
   }
};

int main() {
   Sensor s; 
   s.printType();   // inherited method
   s.printSensor(); // derived method

						return 0;
}
														
Upvote
Downvote
Loading...

Input

Expected Output

Generic Device Sensor Device