Home Segments Index Top Previous Next

623: Mainline

After defining analogous constructors for the other car classes, you could arrange to deposit the serial number in each object by amending the new-car expressions. For example, in the current version of the analyze_train program, the new-car expression for engine objects is as follows:

new engine 

Amended to take an argument, the expression would be as follows:

new engine (input_buffer)