Is there ever an advantage of declaring a struct in C++? Why shouldn't I just make a class consisting only of data members(i.e. no methods)?
Thanks,
When you have a POD type where everything is public is saves a line...
struct Color {
int r;
int g;
int b;
};
vs
class Color {
public:
int r;
int g;
int b;
};
And it's also common practice for objects which are just dumb containers of things. Dumb meaning no constructors, operators, methods.