Is method hiding a form of Polymorphism?

后端 未结 5 1876
夕颜
夕颜 2021-01-03 04:06

Polymorphism is the ability to take many forms. Method overriding is runtime polymorphism.

My questions are:

  1. Is there anything like static polymor

5条回答
  •  天涯浪人
    2021-01-03 04:38

    Polymorphism at runtime takes the form of "dynamic dispatch". That is, the actual method that gets called is determined based on the actual instance you are invoking the method on. Obviously, this applies only when you have an instance of a class, so strictly speaking, polymorphism does not apply to hiding of static methods. For further explanation of the difference check here.

提交回复
热议问题