code_junkie

What is Early and Late Binding?

Nov 10th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Dim oXL As Object
  2. Set oXL = CreateObject("Excel.Application")
  3.  
  4. Dim oXL As Object
  5. Set oXL = GetObject(, "Excel.Application")
  6.  
  7. Dim oXL As Excel.Application
  8. Set oXL = New Excel.Application
  9.  
  10. //early binding:
  11. public create_a_foo(*args) {
  12. return new Foo(args)
  13. }
  14. my_foo = create_a_foo();
  15.  
  16. //late binding:
  17. public create_something(Class klass, *args) {
  18. klass.new_instance(args)
  19. }
  20. my_foo = create_something(Foo);
  21.  
  22. # early binding:
  23. def create_a_foo(*args)
  24. Foo.new(*args)
  25. end
  26. my_foo = create_a_foo
  27.  
  28. # late binding:
  29. def create_something(klass, *args)
  30. klass.new(*args)
  31. end
  32. my_foo = create_something(Foo)
Add Comment
Please, Sign In to add comment