Schaum's Outline Source Code |
455 examples & solved problems complements traditional texts. Costs $24.95 - 10% Chapter 1 Member's Discount + GST + Shipping at the Chapters web site. |
Hubbard, John, 1998 |
John R. Hubbard |
Chapter 7: Abstract Data Types |
Purpose of Programme Click on the name of the file to download it. >>>>>>> |
Programmes | Page |
---|---|---|---|
Example 7.6 | Defines a sum( ) function in the public section of the Ratio class. The sum( ) function gets access to the num and den variables in the private section of the ratio class because sum( ) is declared in the public section of the class. Thus the num and den variables are said to be implicit arguments of the sum( ) function. | Ratio7-6.cpp |
142 |
Example 7.7 | Eliminates the implicit argument by making sum( ) a friend function. Thus both arguments that are to be summed may be passed explicitly! | Ratio7-7.cpp |
144 |
Example 7.8 | Separates definitions of member functions from their declarations. | Ratio7-8.cpp |
144 |
Example 7.9 | Replaces the sum(Ratio, Ratio) function by overloading the + operator. | Ratio7-9.cpp |
146 |
Example 7.10 | Replaces the print() function by overloading the << output operator. | Rat7-10.cpp |
146 |
Example 7.11 | Reduces all fractions to lowest terms and ensures that the denominator is positive. Places the reduce() utility function in the private section of the class but treats the swap() and gcd() functions as free functions. | Rat7-11.cpp |
148 |
Examples 7.12 & 7.13 | Creates an initialization list for the constructors and demonstrates use of default values for constructor parameters. | Rat7-12.cpp |
149 |
Example 7.14 | Creates and invokes a copy constructor. | Rat7-14.cpp |
151 |
Example 7.15 | Declares and implements the assignment operator =. | Rat7-15.cpp |
152 |
Example 7.15m | Declares, implements and invokes the arithmetic operator functions for addition [+], subtraction [-], multiplication [*] and division [/]. | Rat7-15m.cpp |
152 |
csgate@donaldson.org |