Home Segments Index Top Previous Next

216: Mainline

You can start a class definition with either the private part or the public part. Most programmers put the public part first, on the aesthetic ground that what is public should be up front and open to view, whereas what is private should be not so up front and not so open to view.

You can also define classes without specifying the part that member variables and member functions belong to. By default, the C++ compiler takes such member variables and member functions to belong to the private part of the class definition.