Class member: When to declare pvt and public

Please explain to me with least ambiguity when is a class member should be declared public and when private?
read about basic c++ paradigms - in this case: encapsulation:
http://www.tutorialspoint.com/cplusplus/cpp_data_encapsulation.htm
In short:
Data members should be private unless it is just aggregate structure.
Interface should be public (and preferably non-virtual if you are using NVI)
http://isocpp.org/wiki/faq/strange-inheritance#protected-virtuals
http://www.gotw.ca/publications/mill18.htm
Overloadable interface implementation should be private, unless it should be called by derived classes, in this case it should be protected.
MINIPaaa

what is aggregate structure? you mean aggregation and composition etc?
Structure whose only purpose is to group some values together. It has no own behavior, does not do checks, etc. Usually used for data transfer between different applications.
Topic archived. No new replies allowed.