4

We are learning about methods in class, and I am having trouble especially with the concept of static vs. dynamic.

Wikipedia says this:

Methods can be bound to a class at compile time (static binding) or to an object at runtime (dynamic binding).

Can anyone describe what they mean here?

closed as off topic by user8 Oct 2 '11 at 4:04

Questions on Software Engineering Stack Exchange are expected to relate to software engineering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Interpreted languages usually use dynamic binding; compiled ones usually use static binding. Lisp, Scheme, Python, Perl, Ruby, bash, dos scripting are interpreted and use dynamic binding; Java, C, C++ are compiled and use static binding. Does this help? Of course things are harder, as IronPython is compiled down to IL for instance. – Job Oct 2 '11 at 4:01
  • Can you explain more about what exactly you don't understand? What wasn't clear about Wikipedia's articles on dynamic binding and static binding? – user8 Oct 2 '11 at 4:06
  • Well I was moreso wondering what it means to "bind a method to a class" – Dark Templar Oct 8 '11 at 21:57
2

Here are a few links with examples:

Run time binding or compile time binding?

Overloading is compile-time binding

METHOD Overload Vs Overriding

C#, early and late binding

Not the answer you're looking for? Browse other questions tagged or ask your own question.