The analyze_train
program shown in Segment 484 produces an
array of pointers to engine
, box_car
, tank_car
,
and caboose
objects. Subsequently, the analyze_train
program uses a for
loop to display short names:
// Display classes using display_short_name virtual function:
for (n = 0; n < car_count; ++n) {
train[n] -> display_short_name ( );
cout << endl;
}