29 May 15, 06:58PM
(This post was last modified: 29 May 15, 07:26PM by TheNihilanth.
Edit Reason: erratas
)
For that specific case, voteinfo would be either a struct or a class and it will function in the same way with no error nor it would crash because it is a passive data structure. If voteinfo actually were a derived class or implemented virtual methods probably there would be a problem when trying to deserialize it since the actual vtable would override the previous one.
Try changing the struct by class keyword and you'll see for yourself?
Now in the strict sense of OOP if it were a class instead of a struct it would be a badly designed class because it's breaking a corner stone in OOP: Encapsulation, since member data is public, and it should be private and it should provide accessors and mutators as a means to change its state.
Try changing the struct by class keyword and you'll see for yourself?
Now in the strict sense of OOP if it were a class instead of a struct it would be a badly designed class because it's breaking a corner stone in OOP: Encapsulation, since member data is public, and it should be private and it should provide accessors and mutators as a means to change its state.