Click on the button. We can see that a Bird IS-A Animal.
It exhibits similar properties and behaviour to Animals, but may override certain behaviour and may also have additional attributes.
Here is the Animal superclass:
Inheritance is super cool! It has many .
In the above example we can now do this:
Animal tweety = new Bird("Tweety");
tweety.makeSound();
The question is: Do we ever want or need to create a generic Animal eg:
Animal bob = new Animal("Bob");
bob.makeSound();
What sound would Bob make?
Think about these questions:
object
property
method
create an object/instance of a class
instantiate an object
encapsulate
access
mutate
abstraction
idesyntax file class instantiate constructor type propertymethod