|
Aggregate Objects Table Of Contents
pointA = Point( 5, 7 ) pointB = Point() the result graphically would be as shown below Attach:(Defining Classes/ptobjects.png) The two string fields are reference variables since strings are objects. When the \class{Student} object is created, the data fields become aliases of the strings passed to the constructor. \begin{define}[aggregate object] an object composed, in part, of other objects; it contains data fields which are references to other objects. \end{define} \subsection{The Address Class} Consider the \class{Address} class below which defines an object
representing a person’s mailing address. The class does not contain
many useful methods at this time, however, it does provide another
class example.
| |
© 2006 - 2008: Rance Necaise - Page last
modified on September 21, 2006, at 10:02 PM
|