My first post so please go easy on me!
I know that there\'s no real difference between structs and classes in C++, but a lot of people including me use a struct or class
I think there are three major, coherent schools of thought:
struct
and class
interchangeably.struct
s only to represent small POD.struct
s as records.I can't make a conclusive argument for either of these strategies. I tend to follow path 2 but I also use structs for non-POD types when I see it fitting, especially for function objects (even if these may not fulfil POD requirements).
(Incidentally, the C++ FAQ lite has a pretty good definition of POD).
EDIT I didn't touch template metaprogramming techniques, such as using struct
for placeholders (type tags) or to implement metafunctions. I guess there's absolutely no controversy in these cases: since they never contain methods (or even data), always use struct
).