We have already defined a class Sensor with a method:
Sensor
int read() { return 42; }
Your task is to:
unique_ptr<Sensor>
main()
read()
->
Sensor reading: 42
Example
Output:
Why this output?
Because the unique_ptr manages the Sensor object and the read() function always returns 42.
Question Significance
This teaches how to declare and use a unique_ptr to safely manage a dynamically allocated object.
Test Cases
Test Results
Input
Expected Output