0

Inheritance & polymorphism

Did Inheritance & polymorphism can be combined in the same class, Such that a class Inherited from another class also posses polymorphism

22nd Jul 2017, 10:10 PM
Abrar Ahmed
Abrar Ahmed - avatar
2 ответов
+ 2
yes of course,this is the base feature od object oriented principlas.
22nd Jul 2017, 10:24 PM
Highman
Highman - avatar
+ 1
A class needs to use inheritance in order to be polymorphic. Polymorphism is just that: treating a group of different classes that inherit from the same parent as if they were the parent class. For example, treating a fish, a monkey and a bird as just animals.
23rd Jul 2017, 10:17 AM
Denis Felipe
Denis Felipe - avatar