Possible Duplicate:
What are the differences between struct and class in C++
I used to think that the only differences between C++ classes were the private-by-default class member access modifiers and the laid-out-like-C guarantee.
It turns out I was wrong, because this code doesn't compile:
class { int value; } var = { 42 };
whereas this does:
struct { int value; } var = { 42 };
I can't figure out why there's a difference, but there apparently is in Visual C++ 2008:
error C2552:
'var'
: non-aggregates cannot be initialized with initializer list
So, yes, I will ask a many-times-over duplicate question (hopefully without duplicate answers!):
What are all the differences between structs and classes in C++?
Of course, feel free to close this if you find that I've missed something in the other questions -- I certainly might have. But I didn't see this being discussed in any of the answers, so I thought I'd ask.