Is there any advantage over using a class over a struct in cases such as these? (note: it will only hold variables, there will never be functions)
class Foo { private: struct Pos { int x, y, z }; public: Pos Position; };
Versus:
struct Foo { struct Pos { int x, y, z } Pos; };
Similar questions:
There is no real advantage of using one over the other, in c++, the only difference between a struct and a class is the default visibility of it’s members (structs default to public, classes default to private).
Personally, I tend to prefer structs for POD types and use classes for everything else.
EDIT: litb made a good point in the comment so I’m going to quote him here: