#include <iostream>
using namespace std;
class Device {
public:
int id;
};
int main() {
Device d;
d.id = 101;
cout << "Device ID: " << d.id;
return 0;
}
Solution Explanation
The class Device is already defined.
In main(), an object d is created.
The program assigns 101 to id and prints it.
Layman’s Terms
Think of Device as a template. You make one device (d) and give it an ID number. Then you just print it.
Significance for Embedded Developers
This is like working with predefined driver structs in embedded firmware. You don’t define the struct (class) yourself — you just declare an object, fill values (like an ID, config, or mode), and use it.