cs1ch5sec8.htm
 
CHAPTER 5

Object-Oriented Design
 


Section VIII : Expanding the Idea of Classes Section I: The Object-Oriented Paradigm  Section II: Class Analysis and Design Section III: CRC Cards Section IV: Classes in C++
Section V: Defining Classes Section VI: Using Class Declarations in a Program Section VII: Constructors


  


Table of Contents

Learning C++:
An Index of Entry Points


2. The

of C++

A reference document on the basic elements of C++.



3. The Patterns



Index!


 

 

 

A common misconception at this point is that classes have only Provide and Change functions. Consider, however, a "Weight" class, with the two properties, pounds and ounces. Consider further that whoever needs this class wants to be able to add and subtract instances of this class. (We all know that adding or subtracting two English weights is not as easy as doing the same with metric weights. Figure 5.4 shows a possible CRC card for this Weight class. Note how it has more than Provide and Change functions.

We will not bother to go any further here and declare, define or use this class. Hopefully, however, you get the idea that the simple classes you have studied so far are only the tip of the iceberg as to what classes really can be used for. In other courses you will learn about classes used to create user interfaces, manage complex processes, and implement data structures such as lists of objects. If you want to get an introduction to classes as data structures, read Chapter 8 Section III.

Top of Section Main Menu Next Chapter