So I am learning the Polymorphism now, i simply cannot understand why would i override a function in the base class from the subclass instead of overloading the function in the base class so i could call it with different parameters. Could someone please explain this to me? Maybe I am just missing something here..
Asked
Active
Viewed 100 times
0
-
Please show an example of what you say :) – Claudio Redi Jun 12 '15 at 12:14
-
So you can have different subclasses behave differently in response to the same call. – Ant P Jun 12 '15 at 12:14
-
The two things you're describing are very different things. It's not clear what you're asking. Function overloading has nothing to do with polymorphism. – David Jun 12 '15 at 12:15
-
Please, please, please, learn about interfaces and composition, rather than polymorphism. Inheritance is increasingly falling out of favour, so learn what's regarded as good practice instead. – David Arno Jun 12 '15 at 12:15