Manage a Device with a unique_ptr

#include <iostream>
#include <memory>
using namespace std;

class Sensor {
public:
    int read() { return 42; }
};

int main() {
    // your code here: declare unique_ptr<Sensor> and call read() using ->
    unique_ptr<Sensor> sens = make_unique<Sensor>();
    cout<<"Sensor reading: "<<sens->read();

    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Sensor reading: 42