January 2018
Intermediate to advanced
678 pages
20h 16m
English
new Operator, MethodsAt a bare minimum, to implement a class, you need a class heading and a class body, and within the class body, you need a constructor and at least one method. To explain these things, we’ll present a class that defines a point with x and y properties for the point’s x and y coordinate positions. In FIGURE 11.2, note the class heading, which uses the word class, followed by a name that describes what the class represents. In this case, the class represents a point, so Point is the perfect name.
FIGURE 11.2 Bare-bones class definition for a Point class
Read now
Unlock full access