+ 26
Can I say polymorphism analogues to overloading(not litrally of course) if so how?
5 ответов
+ 3
there is quite a difference between polymorphism and overloading. overloading makes it possible for a class to use more than one method with the same name as long as they differ in their arguments. polymorphism does not only refer to one or more methods in one class. it refers to parental and child classes, which use methods with the same name. sometimes they even use them in different ways (override). so it is not really possible to use these words as analogues.
+ 2
Polymorphism is a way to call methods of different children classes through virtual methods of one parent class. Your module could not have whole information about children types. The only reference to parent type is enough to make correct calls. You have to provide all available function overloads to be able call them. There is no way to get different implementations through one call by overloading feature.
+ 1
B11010 overloading and overriding is done for function...that is the only similarity is between both of them... One require different type or number of argument where as riding require same number of argument...
0
هلا
0
😖