In addition to reducing duplication, there are other reasons for exploiting inheritance, such as the following:
Attraction
class.
To prevent the gratuitous
introduction of bugs, you would want to use that class definition as it
stands, rather than, say, copying bits of the Attraction
class
definition into the Movie
and Symphony
class definitions.
Attraction
class
from a vendor, because you anticipate using the elaborate capabilities
advertised by that vendor. Because the vendor supplies you with compiled code only, you cannot
access the source code, so you cannot copy bits of the vendor's
Attraction
class definition into your Movie
and
Symphony
class definitions. You can only define new classes that
inherit from your purchased classes.