#include <iostream>
using namespace std;

class Sensor {
private:
      int ID;
public:
      void set_id(int id) { ID = id; }
      void get_id(int &id) { id = ID; }      
      Sensor(int id)
      {
            set_id(id);
            cout << "Sensor " << id << " initialized" << endl;
      }
      // your code here: define constructor taking int id and printing "Sensor <id> initialized"

};

int main() {
   Sensor s(101);
   return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Sensor 101 initialized