13/13 step 3


#1



What does this mean and how do I do it?
**Modify the Coffee class so that it inherits from the Beverage class.**


#2

Remember in the previous exercise we used the extends keyword on Dog to inherit the Animal class?

Well this is essentially the same thing.

We want to inherit the Beverage class's attributes and methods because it has a method in there that makes sense to use for Coffee because coffee is-a Beverage.

Say we had another class similar to Coffee, but instead called it Water. We don't inherit from coffee because coffee has addSugar(). That doesn't make too much sense for water. But we can inherit from beverage as well and save on coding time because the method isFull() in side of the beverage class makes sense to use for the Water class.

Is that a little easier to comprehend or have I just made it more confusing for you.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.