GeekInterview.com
Series: Subject: Topic:
Question: 15 of 38

What is the purpose/uses of run-time polymorphism? Is dynamic binding only way to achieve run-time polymorphism?

Asked by: JulieAsh07 | Member Since Feb-2007 | Asked on: Jul 24th, 2007

View all questions by JulieAsh07   View all answers by JulieAsh07

Showing Answers 1 - 3 of 3 Answers
sampra

Answered On : Mar 10th, 2008

View all answers by sampra

yes dynamic binding is only concept to achive the runtime polymorphism.whole j2ee tech is based on RTP only  

  
Login to rate this answer.
goksn

Answered On : Sep 14th, 2009

View all answers by goksn

Purpose of Runtime polymorphism:

Run time polymorphism is a mechanism by which a call to overriden function is resolved at runtime rather than compile time.

For e.g

If (user clicks link 1) then
{
obj1.overriddenfunction()
}
else
{
obj2.overriddenfunction()
}

according to obj1 or obj2 , the appropriate method is called.

Dynamic binding is the only way to achieve run time polymorphism.

Yes  1 User has rated as useful.
  
Login to rate this answer.
sflebrun

Answered On : Sep 15th, 2009

View all answers by sflebrun

Run-time polymorphism provides the ability to use late-binding.  In other words, the function called or the data member accessed is not determined until run-time and is based on the type that a variable references.  Run-time polymorphism allows the support of inheritance and function overriding.  On the flip side, polymorphism uses early-binding to support features such as function overloading, features that can be determined at compile-time.

Dynamic binding is one of several ways to achieve run-time polymorphism.   There are various ways of implementing dynamic binding.  Dynamic binding uses tables "binding", or maps, linking names to memory locations.  The memory locations can be the entry point to function or data location.  These tables can be built during compilation or, depending on the implementation, could be constructed and modified at run-time each time an object of a new data type is created.  In dynamic binding, only a single map or table of bindings exists, either as a global table or a separate table for each data type.

An alternative to dynamic binding is lexical binding.  In lexical binding, the map of name to memory location is associated with each variable instead of each data type as in dynamic binding.  Lexical binding is commonly used in languages like lisp and scheme.

Yes  1 User has rated as useful.
  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.