Closed simonlynen closed 11 years ago
I second this, and even go further: struct are just classes with public members by default, there are use cases for which they make perfectly sense.
I agree with Stephane. I like to use structs (with constructors) for simple POD types with no real methods.
And this is likely to be increasingly useful in C++11 with the extension of the span of POD, the initializer list, and the {} syntax for initialising objects.
I don't agree with the wiki text: "Note that structs are kept in C++ for compatibility with C only, and avoiding them increases the readability of the code by reducing the number of constructs used. Use a class instead."
I would prefer using structs as pure data structs and classes in all other cases