views:

128

answers:

4

Hi everyone,

i was asked this question in an interview.

late binding is dynamically identifying the symbol during the runtime as far as my knowledge is concerned.please correct me if i am wrong.

i was asked a question like what are some of the problem that we would face when we use late binding in c++. i was actually out of my own ideas about that.

could you please share the problems you might have faced during your professional life.

thanks.

+1  A: 

Late binding requires the developer to specify the function signatures themselves as compiler is unable to validate as usual. Also, correct data types need to be used to prevent stack corruption.

YeenFei
+1  A: 

Even when you have function pointers late binding is used. Late binding is runtime polymorphism. It basically means problems associated with virtual functions.

http://www.learncpp.com/cpp-tutorial/124-early-binding-and-late-binding/ Link provides you with all you need to know.

ckv
I thought the answer was relevant. Can anybody let me know the reason for the downvote.
ckv
+1: This is the correct answer; late binding doesn't have anything to do with dynamically loaded modules.
Frerich Raabe
+1  A: 

Advantages:

  • In accordance with the Open-Closed Principle: the code can be extended with new instruction without changing existing code.

Disadvantage:

  • More code to write
  • Cannot be inlined
Pardeep
A: 

1.You cannot create a generic object which may be bound to different types of objects. 2.It is error prone and you will not enjoy much intellisense whilst coding.

Can you provide examples for justifying your reasons. That would be more helpful.
ckv