+ 2

Using a parent class as a paremeter to avoid writing code for all children classes

I have a rocket class. There are two other classes that act as rocket types so they have extended from the rocket class. (class U1 and class U2) There is a method called runSimulation that takes in a parameter. Can this method be written once and have it work with both the U1 class and U2 class. Could by using the parent class Rocket help in solving this?

10th Dec 2017, 11:47 PM
Haitham Alhad Hyder
Haitham Alhad Hyder - avatar
1 ответ