![]() |
![]() |
![]() |
![]() |
![]() |
|
So far, you have learned how you can define classes for two entertainment
types: movies and symphonies. Now, suppose that you want to add information
that is common to all entertainment types, such as an instance variable,
minutes, that records duration.
One way to proceed is to start with the classes that you have already
defined for movies and symphonies, adding a minutes instance
variable to both classes. If you define movies and symphonies in this way,
adding the minutes instance variable to the Movie and
Symphony class definitions creates exact duplicates.