6.2 Public

Everything that is not private should be public, at least for the time being. In another module, we'll explore the meaning of protected.

The collection of public members of a class defines the user interface of a class. A consumer of a class can only use the user interface to access objects of the class.

A section of class definition can become public after the keyword public, followed by a colon.

As per the discussion of ``no data member should be in the user interface'', the public section of a class definition should not include any data members.



Copyright © 2006-09-07 by Tak Auyeung