Public Versus Private
The assist us with the task of information hiding we can use the keywords public and private
- public indicates that the definitions in the following section can be “seen’ by the outside of the class
- private indicates that the definitions in the following section can only be “seen’ from within the class (i.e. by member functions of that class)
-
Though you can have as many public and private sections in a class definition as you’d like typically we group all the public members in one section (the first section) and all the private members in another
By default all members of a class are private
All of our member variables will be private!