Object Declaration and Variable Access

#include <iostream>
using namespace std;

class Device {
public:
    int id;
};

int main() {
    Device x;        
    x.id = 101;      
    cout << "Device ID: " << x.id;  
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Device ID: 101