We have already defined two classes:
Device
int id
Sensor
int value
Your task is to:
101
id
75
value
Device ID: 101, Sensor Value: 75
Example
Output:
Why this output?
The Sensor object contains both its own variable value and the inherited variable id from the Device class.
Question Significance
This problem demonstrates public inheritance and how derived class objects access base class members.
Test Cases
Test Results
Input
Expected Output