Private variables are a way to hide complexity and implementation details to the user of a class. This is a rather nice feature. But I do not understand why in c++ we need to put them in the header of a class. I see two annoying downsides to this:
- It clutters the header from the user
- It force recompilation of all client libraries whenever the internals are modified
Is there a conceptual reason behind this requirement? Is it only to ease the work off the compiler?
struct foo{};) is not allowed, but forward declarations (struct foo;) are. – MSalters Apr 10 '12 at 12:43