why do we need to put private members in headers
Posted
by
Simon
on Programmers
See other posts from Programmers
or by Simon
Published on 2012-04-10T09:25:03Z
Indexed on
2012/04/10
11:40 UTC
Read the original article
Hit count: 327
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 some 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 of the compiler?
© Programmers or respective owner