Presentation is loading. Please wait.

Presentation is loading. Please wait.

Inheritance New class derived from existing class Software engineering technique Software reuse : faster, easier, cheaper Parent class (supper class):

Similar presentations


Presentation on theme: "Inheritance New class derived from existing class Software engineering technique Software reuse : faster, easier, cheaper Parent class (supper class):"— Presentation transcript:

1 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

2 Inherit variable and method Words book dictionary Method vs variable visibility Protected : encapsulation

3 Words Book Dictionary super reference Default constructor

4 Overriding Message Thought Advice Method overriding Shadowing variable final modifier for method Public final class Standards { }

5 Class hierarchies A class derived from one parent can be the parent of its own child class Abstract class : interface class Multiple inheritance

6 Visibility FoodAnayzer FoodItem Pizza FoodItem object never created

7 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


Download ppt "Inheritance New class derived from existing class Software engineering technique Software reuse : faster, easier, cheaper Parent class (supper class):"

Similar presentations


Ads by Google