dynamic-binding

What is the difference between Early and Late Binding?

瘦欲@ 提交于 2019-11-26 03:33:39
问题 What is the difference between early and late binding? 回答1: The short answer is that early (or static) binding refers to compile time binding and late (or dynamic) binding refers to runtime binding (for example when you use reflection). 回答2: In compiled languages, the difference is stark. Java: //early binding: public create_a_foo(*args) { return new Foo(args) } my_foo = create_a_foo(); //late binding: public create_something(Class klass, *args) { klass.new_instance(args) } my_foo = create

Java dynamic binding and method overriding

两盒软妹~` 提交于 2019-11-26 02:28:29
问题 Yesterday I had a two-hour technical phone interview (which I passed, woohoo!), but I completely muffed up the following question regarding dynamic binding in Java. And it\'s doubly puzzling because I used to teach this concept to undergraduates when I was a TA a few years ago, so the prospect that I gave them misinformation is a little disturbing... Here\'s the problem I was given: /* What is the output of the following program? */ public class Test { public boolean equals( Test other ) {