|Synopsis:||Declare non-constant data members private|
As a consequence when data needs to be accessed, be it by a derived class or an external class, protected or public Set and Get methods (Accessors) need to be implemented for these private data members. This way, the class implementation is separated from the class interface.
Note that declaring data members protected is usually a design error, and easily becomes a maintenance problem. See the convincing justification in section 18.104.22.168 of [Stroustrup]. If you want to model a data structure, with public access to its data members, then use a struct type.
Exception: constant data members are often used as constant values with no need of information hiding. In this case it's allowed to declare these members public or protected.