سؤال

Is there any direct relationship between Late Binding and Overriding, similarly for Early Binding and Overloading?

They (Binding/Overriding/Overloading) can be termed as ways to implement polymorphism, but is there any "Direct Relationship" ex: Late Binding is a sub/super concept to Overriding and vice versa etc?

هل كانت مفيدة؟

المحلول

They are orthogonal (independent) concepts.

  • Overloading, Overriding: Forms of polymorphism
  • Early binding/Late binding: In the former, the method to call is known at compile time. In the latter, at runtime.

Of course, an implementation of overriding usually implies using late binding, because you will only know the object's real type at runtime. But that's just a special case.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top