I was wondering why he used enum {size = (sizof(obj))};
and found that it is because only static const variables can be initialized in declaration.
So is my understanding correct that a static const variable of a class will be the same for every instance of the class that is declared. Where as the enum will allow for each instance to have its own values?
Where as the enum will allow for each instance to have its own values?
Enumerated members are constant, Therefore, modifying them is disallowed. Enumerated members can be accessed just like any other member. However, when the structure is defined, along with the enumerated members, a value is given to them. No matter how many instances of that structure you create, those values will remain the same for all instances. For example: