Problem of the Day
Problem:
A company rents vehicles for transporting people's belongings from one place to another, and uses software to track their inventory. The software uses classes for Rental
, PoweredVehicle
, Truck
, Van
, and Trailer
(for clients who want a trailer for their own vehicle or for a truck). How should the classes be structured to make good use of inheritance?
The correct answer is c. The upward arrow that points from a sub-class to a super-class indicates an "is-a" relationship: a Trailer
"is a" Rental
, and a Van
"is a" PoweredVehicle
which in turn "is a" Rental
itself.