C++ - struct vs class vs union
- struct: data members default to
public. - class: data members default to
private. - union: a special class type that can hold only one of its non-static data members at a time. (Similar to
oneofin ProtoConf)
Google style guide suggests: "Use a struct only for passive objects that carry data; everything else is a class."
https://google.github.io/styleguide/cppguide.html#Structs_vs._Classes