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
One side point is that structs are often used for aggregate initialized data structures, since all non-static data members must be public anyway (C++03, 8.5.1/1).
struct A { // (valid)
{
int a;
int b;
} x = { 1, 2 };
struct A { // (invalid)
private:
int a;
int b;
} x = { 1, 2 };
class A { // (invalid)
int a;
int b;
} x = { 1, 2 };
class A { // (valid)
public:
int a;
int b;
} x = { 1, 2 };
class A { // (invalid)
public:
int a;
private:
int b;
} x = { 1, 2 };
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:
one important other difference is that structs derive from other classes/struct public by default, while classes derive privately by default.
The only difference between a class and a struct is that struct members are public by default and class members are private by default. So I say go with whichever one you like best. I'm sure there are arguments to be made in terms of which one is more readable, but I really don't think it's a big deal.
"(note: it will only hold variables, there will never be functions)"
Never is a big word. Usually "never" means "eventually". Since that's the case, I'd suggest you use a class. That way, when things change, you don't have so much to change.
The Java (and Python) folks have gotten along fine with everything being a class. It hasn't hurt them any to not have these specialized method-less classes that C++ calls a "struct".
Essentially the choice between a struct and a class comes down to your style and how much you want to type.
struct
and class
mean exactly the same thing in C++ with the exception that the default access for struct members and bases is public whereas it is private for classes. I tend to chose struct for classes that only have public members and classes for everything else, but it's only a style issue.