Reply To: C++ Programming
I have somehow overlooked the C++ data type of “struct” until now, probably because it was not mentioned in the online course I did.
Anyway a srtuct is a type of simple class where all member variables are public and member functions are not allowed except for the case of constructors which have the same name as the struct.
The member variables can be of any type so a simple struct could be useful as a member of a vector, say, but as all members are public you can not force people to call a constructor to type check their values before changing them.
Come to think of it, may not be so useful after all 😂