chapter  6
22 Pages

Points in the Plane

The first part of this book introduces the fundamental data types (long, double, bool, etc.), arrays of these types, and procedures. C++ provides the ability to define new types of data that can be used just as the

basic types are. New data types that we create are called classes. In this chapter we create a class called Point that represents a point in the Euclidean plane. When we want a variable to represent an integer quantity, we declare it to be type long (or one of the other integer types). Likewise, once we have the Point class set up, we can declare a variable to represent a point in the plane like this:

We call X an object of type Point.