Suppose that we have a function that registers a Vehicle object. We also have a Car object that is a specialized Vehicle (defined by inheritance). The substitution principle states The Car object can be used in the Vehicle registration function because it is a kind of Vehicle. The Car object can never be used in any function that is written to use a Vehicle object. The Vehicle object can always be used wherever a Car object is expected. A new registration function that is written to use a Car object can be used in place of the Vehicle registration function.

icon
Related questions
Question
C++
Suppose that we have a function that registers a Vehicle object. We also have a
Car object that is a specialized Vehicle (defined by inheritance). The substitution
principle states
The Car object can be used in the Vehicle registration function because
it is a kind of Vehicle.
The Car object can never be used in any function that is written to use a
Vehicle object.
The Vehicle object can always be used wherever a Car object is expected.
A new registration function that is written to use a Car object can be used in
place of the Vehicle registration function.
Transcribed Image Text:Suppose that we have a function that registers a Vehicle object. We also have a Car object that is a specialized Vehicle (defined by inheritance). The substitution principle states The Car object can be used in the Vehicle registration function because it is a kind of Vehicle. The Car object can never be used in any function that is written to use a Vehicle object. The Vehicle object can always be used wherever a Car object is expected. A new registration function that is written to use a Car object can be used in place of the Vehicle registration function.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer