Lets say I have the following class:
static int counter = 0;
class Account {
public:
int ID;
int favNumber;
Account(int favNum) {
this->ID = ++counter;
this->favNumber = favNum;
}
};
Account user1(4);
Account user2(9);
Now both accounts user1 and user2 have different ID that is unique. Is there any way by knowing the ID of the account get the field of the object like "favNumber", if so how should it be implemented?
Something like getFieldById(int ID)