#include <iostream>
using namespace std;

class Device {
public:
    void showType() {
        cout << "Generic Device"<<endl;
    }
};
class Sensor:public Device
{
    public:
    void showSensor()
    {
        //Device::
        showType();
        cout<<"Sensor Device"<<endl;;
    }
};
// your code here: define class Sensor with protected inheritance from Device
// implement showSensor() that calls showType() and then prints "Sensor Device"

int main() {
    Sensor s;
    s.showSensor();  // should print both lines
    return 0;
}///code><\/pre>"}
Upvote
Downvote
Loading...

Input

Expected Output

Generic Device Sensor Device