Mohamed Suood wrote:
boatList[0].setMastHeight(12); // <<=== something is woring here in this line.
The issue is... setMastHeight(12) method is not a method of Boat class, and your instance is of a Boat class. Hence the issue.
If you want to set setMastHeight, you need to use the instace of SailBoat class.
Prabhakar Reddy Bokka wrote:and your instance is of a Boat class.
To be more precise the reference variable is of type Boat and that is what is used to determine what methods can be called.
The instance is actually a SailBoat object.