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?

Dark Templar
  • 6,223
  • 16
  • 46
  • 46
  • 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 02 '11 at 04:01
  • Can you explain more about what exactly you don't understand? What wasn't clear about Wikipedia's articles on [dynamic binding](http://en.wikipedia.org/wiki/Dynamic_dispatch) and [static binding](http://en.wikipedia.org/wiki/Static_binding#Binding_time)? –  Oct 02 '11 at 04:06
  • Well I was moreso wondering what it means to "bind a method to a class" – Dark Templar Oct 08 '11 at 21:57

1 Answers1

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

RPK
  • 4,378
  • 11
  • 41
  • 65