Learning OOD and been asked to define a few terms, this is my own interpretation of Polymorphism, is it correct?
Polymorphism:
Polymorphism allows you to have a function in a parent class but is then overriding in the child classes to give different outcomes using the same function inherited from the parent. The child class uses the basic function in different ways for example a calculator in the parent class can be used in one child class to work out wages, while in another class to calculate hours worked. The calculator code exists in the parent class, but does different jobs in the child classes below, saving time and code, the most important part of programming.
Thanks for viewing.
Polymorphism:
Polymorphism allows you to have a function in a parent class but is then overriding in the child classes to give different outcomes using the same function inherited from the parent. The child class uses the basic function in different ways for example a calculator in the parent class can be used in one child class to work out wages, while in another class to calculate hours worked. The calculator code exists in the parent class, but does different jobs in the child classes below, saving time and code, the most important part of programming.
Thanks for viewing.