April 2019
Intermediate to advanced
360 pages
9h 17m
English
Inheritance is a powerful OOP construct. We can model objects efficiently, as was illustrated with the bicycle. We know that the following relationships exist:
When we program inheritance, we should perform the "IS A" Checks using the following pseudo-code logic:
if ( <new child object> is a <parent object> ) then relationship = True; else relationship = False
If our "IS A" Checks fails, then inheritance should be avoided. This is an important test that, with dedicated use, can help ensure that inheritance lines between objects are valid.
Let's create the "IS A" Checks for our Bicycle class. We will do this by using Java's instanceof operator. ...
Read now
Unlock full access