All submissions
#include <iostream>
using namespace std;

class Device {
   public:
      void printType()
      {
         std::cout << "Generic Device" << std::endl;
      }
};

class Sensor : public Device {
   public:
      void printSensor()
      {
         std::cout << "Sensor Device" << std::endl;
      }
};

int main() {
   Sensor s;
   s.printType();    // inherited method
   s.printSensor();  // derived method
   return 0;
}
Loading...

Input

Expected Output

Generic Device Sensor Device