Polymorphism vs Overriding vs Overloading

前端 未结 21 2808
北恋
北恋 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:28

    You are correct that overloading is not the answer.

    Neither is overriding. Overriding is the means by which you get polymorphism. Polymorphism is the ability for an object to vary behavior based on its type. This is best demonstrated when the caller of an object that exhibits polymorphism is unaware of what specific type the object is.

提交回复
热议问题