Solution: Implement Inheritance Hierarchy

This lesson provides a solution to the inheritance coding challenge.

We'll cover the following

Solution #

The member functions that are declared as abstract by superclasses must be defined by the override keyword by subclasses.

Locomotive.makeSound and RailwayCar.makeSound can be implemented as in the following program:

Get hands-on with 1200+ tech skills courses.