Polymorphism vs Overriding vs Overloading

前端 未结 21 2829
北恋
北恋 2020-11-22 01:10

In terms of Java, when someone asks:

what is polymorphism?

Would overloading or overriding be

21条回答
  •  青春惊慌失措
    2020-11-22 01:20

    overriding is more like hiding an inherited method by declaring a method with the same name and signature as the upper level method (super method), this adds a polymorphic behaviour to the class . in other words the decision to choose wich level method to be called will be made at run time not on compile time . this leads to the concept of interface and implementation .

提交回复
热议问题