Changes between Version 13 and Version 14 of ControlSystems/SoftwareTeam/Training/GettingStarted/IntroJava
- Timestamp:
- Oct 7, 2019, 11:44:33 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/IntroJava
v13 v14 186 186 }}} 187 187 188 === Inherit ence188 === Inheritance 189 189 Classes can be extended so that you don't need to replicate lots of code. This is particularly useful when there is a hierarchical relationship between classes. For example, you can define a class Fruit and then extend it with sub-classes Orange, Apple, Banana. Each of the sub-classes meets the "isa" test: an Apple isa Fruit. When a class extends another class, it inherits all of the attributes and functions of the parent (super) class. So for example consider the following classes: 190 190 {{{