Object Declaration and Variable Access

#include <iostream>
using namespace std;

class Device {
public:
    int id;
    Device(int x)
    {
        id = x;
        cout<<"Device ID: "<<x<<endl;
    }

};

int main() {
   Device d(101);

    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Device ID: 101