0

First off, Binding means matching the function call with the correct function definition by the compiler. This resolution takes place either at compile time or at runtime.

In early binding, the compiler matches the function call with the correct function definition at compile time.

In overload resolution, the compiler matches the function call with the correct viable function from a set of viable candidates based on some rules.

So it seems to me that both are very close and related to each other: the function is resolved at compile time but it may be called at runtime.

My questions:

  • Do "early binding" and "overload resolution" equivalent?
  • Does "early binding" can be implemented outside the class?
  • Are early binding requires an object to call the methods,

for example:

void f(int);
void f(double);
f(1.2); 

The overload resolution finds void f(double) as an exact match for f(1.2) call. But does this also mean that the call is bound early?

Sofa Joe
  • 169
  • 6
  • Nothing in the definition of "overload resolution" as a general term requires that it happens at compile-time. Indeed, a fully interpreted language implementation can clearly have some form of overload resolution despite that it has no compiler. In contrast, "early binding" literally means "binding at compile-time", and so it clearly cannot happen without a compiler. More generally, overload resolution is about choosing a function from a list of functions with the same name. Binding is about linking a function call to the function entry. Overload resolution may be a *prerequisite* to binding. – Alexander Guyer May 10 '22 at 04:14

0 Answers0