My first post so please go easy on me!
I know that there\'s no real difference between structs and classes in C++, but a lot of people including me use a struct or class
I might be in the minority, but I use struct
s to mean one thing, "the order of the bits matters". Anything that must be serialized to disk or network, or has to be compatible with some third party library and needs to be in the right order, Or if it's doing some kind of bit field magic as a processor specific optimization, that always goes into a struct
. Rearranging the fields in a struct
, therefore, always has some kind of consequences and should be carefully thought out.
class
es, however, have fields that are only semantically meaningful. If for some reason I or someone else wants to rearrange or modify the data members of a class
, this can happen pretty freely.