Home Segments Index Top Previous Next

504: Mainline

But now you have to face a problem: How do you call the volume function from inside a display_capacity function? Ordinarily, you call the volume function by writing down an expression that evaluates to a box_car object, then the class-member operator, and finally the symbol volume and an empty argument list:

box_car object.volume ( ) 

You call the yet-to-be-defined display_capacity function the same way:

box_car object.display_capacity ( ) 

Hence, the class object acts like an argument; however, unlike an ordinary argument, the class object has no corresponding parameter inside either display_capacity or volume. How then do you specify that you want the volume function to work on the same class object that was handed over to display_capacity?