Home Segments Index Top Previous Next

660: Mainline

Subtle problems arise when you define functions with call-by-value parameters that have class objects as values. You have already learned about one such problem: If the object handed to a function actually is a subclass of the parameter's class, only the superclass portion of the object is copied into the memory temporarily reserved for the parameter.

Another, quite different, problem arises when you define your own destructor functions. In preparation for understanding the problem, you need to examine an example function that has a call-by-value railroad_car parameter.