// Your task is to:
// Declare a Sensor object in main().
// Assign 101 to id (inherited from Device).
// Assign 75 to value (from Sensor).
// Print both values in the format:
// Device ID: 101, Sensor Value: 75
// Device ID: 101, Sensor Value: 75
#include <iostream>
using namespace std;
class Device {
public:
int id;
void printDevice(){
cout << "Device ID: " << id << ", " << flush;
}
};
class Sensor : public Device {
public:
int value;
void printSensor(){
cout << "Sensor Value: " << value << endl;
}
};
int main() {
// your code here: declare Sensor object, assign id and value, and print them
Sensor s;
s.id = 101;
s.value = 75;
s.printDevice();
s.printSensor();
return 0;
}