All submissions
#include <iostream>
using namespace std;

class Device {
public:
    void showType() {
        cout << "Generic Device\n";
    }
};

class Sensor : protected Device
{
public:
    void showSensor()
    {
        this->showType();
        cout << "Sensor Device\n";
    }
};

int main() {
    Sensor s;
    s.showSensor();  // should print both lines
    return 0;
}
Loading...

Input

Expected Output

Generic Device Sensor Device