Schaum's Outline Source Code

[John Hubbard:  
          Schaum's Outline of FUNDAMENTALS OF COMPUTING WITH C++]
Meets 1998 ISO Standard!

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
Schaum's Outline of FUNDAMENTALS OF COMPUTING WITH C++ (McGraw Hill: Toronto) ISBN: 0-07-030868-3

Click here for source code at author's web site.

[Photo of John R. Hubbard]
John R. Hubbard
Go to Chapter:   1 2 3 4 5 6 7 8 9 10 11 12 13 14

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
[Home of Gerry Donaldson's Com Sci Gate       
[Gerry Donaldson's Email Address]
csgate@donaldson.org
[EFC Blue Ribbon - Free Speech Online]

URL:   www.donaldson.org    Last Revised:   May 14, 2000.