![]() |
![]() |
![]() |
![]() |
![]() |
|
Suppose that you try to fix the problem raised in Segment 548 by
defining additional functions specialized to the various
railroad_car subclasses:
double ordinary_capacity_function (box_car b) {
return b.capacity ( );
}
double ordinary_capacity_function (tank_car t) {
return t.capacity ( );
}
double ordinary_capacity_function (engine e) {
return e.capacity ( );
}
double ordinary_capacity_function (caboose c) {
return c.capacity ( );
}
Does the program perform correctly with these additional functions? Explain your answer.