January 2014
Intermediate to advanced
352 pages
8h 21m
English
Let us consider a situation where we have a class called ‘length’ which represents the length of an item (say cloth) in feet and inches. Its class diagram is shown in Fig. 9.1.
Figure 9.1 A class called ‘length’
Now if we desire to add two objects of this class type, one of the options is to use a friend function (say add()) as shown below:

The following main() function tests the above given class.

A sample ...
Read now
Unlock full access