All submissions

Object Declaration and Variable Access

#include <iostream>
using namespace std;

class Device {
public:
    int id;
};

int main() {
    Device d1;          // declare Device object
    d1.id = 101;        // assign 101 to id
    cout << "Device ID: " << d1.id << endl;  // print it
    return 0;
}
Loading...

Input

Expected Output

Device ID: 101