Inheritance New class derived from existing class Software engineering technique Software reuse : faster, easier, cheaper Parent class (supper class): Y (mammals) Child class:X (horse) X is a Y extends
Inherit variable and method Words book dictionary Method vs variable visibility Protected : encapsulation
Words Book Dictionary super reference Default constructor
Overriding Message Thought Advice Method overriding Shadowing variable final modifier for method Public final class Standards { }
Class hierarchies A class derived from one parent can be the parent of its own child class Abstract class : interface class Multiple inheritance
Visibility FoodAnayzer FoodItem Pizza FoodItem object never created
8.1. Design and implement a class called MonetaeryCoin that is derived from the Coin class. Store a value in the monetary coin that represent its value and add a method that returns its value. Create a main driver class to instantiate and compute the sum of several MonetaryCoin objects. Demonstrate that a monetary coin inherit its parents ability to be flipped. coin coinflip