way to construct new data types. Consider working with two-dimensional
positions (such as x and y coordinates, or latitude and longitude) in your program.
You want to express operations on these positional values with normal arithmetic
independent numerical quantities. By creating a class that incorporates these two
16
Object Oriented Programming Using C++
values, and declaring position1, position2, and origin to be objects of this class,
you can, create a new data type. Many features of C++ are intended to facilitate
the creation of new data types in this manner.
Do'stlaringiz bilan baham: