string name; //The player will enter their name so name will not be constant
vector<float> bankAccounts; //this stores the money in the list.
cool, now if i want to just create variables and group them together i just use a struct but if i want to do something like polymorphism or something than i just use a class? Also since a struct is public i dont need to have "public:" in there anymore right?
> so basically theres no advantage or reason to switch to a struct?
No. When the keywords struct or class is used to declare or define a user-defined type, other than the default access specifier for members and base classes, there is no semantic difference between the two.
In common header files that are designed to be used with both C++ and C, use the keyword struct.
Anywhere else, you can choose to use either one.
to give an example, I mostly use the keyword struct when declaring functors that have just one public member function (the function-call operator) and metafunctions that have just one public member type. Just because it makes them easier to read.
So what was the point of Bjarne Stroustrup implementing classes in c++ if the only difference is access level? didnt structs have public and private back then when it was just C? why couldnt you just use public and private in the struct?