Summary: Class Definitions—the Fundamentals
In this lesson, we summarize what we covered in this chapter.
We'll cover the following...
-
A class is a plan for creating objects. It contains declarations for the data fields associated with its objects and definitions of methods that implement the objects’ behaviors.
-
The words
public
andprivate
are examples of access modifiers that indicate where a class, method, or data field can be used. Any class can use something that is public. A private class, method, or data field can be used only by the class that defines it. -
When creating a class, we should specify its methods and write statements that use them. Only after we are satisfied with our design should we implement the methods.
-
We should make each data field in a class private by beginning its declaration with the access modifier
private
. Doing so forces a ...