GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 24 of 31    Print  
What is the purpose/uses of run-time polymorphism? Is dynamic binding only way to achieve run-time polymorphism?

  
Total Answers and Comments: 3 Last Update: September 16, 2009     Asked by: JulieAsh07 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 10, 2008 04:48:26   #1  
sampra Member Since: February 2008   Contribution: 278    

RE: What is the purpose/uses of run-time polymorphism? Is dynamic binding only way to achieve run-time polymorphism?
yes dynamic binding is only concept to achive the runtime polymorphism.whole j2ee tech is based on RTP only
 
Is this answer useful? Yes | No
September 14, 2009 01:48:24   #2  
goksn Member Since: May 2009   Contribution: 94    

RE: What is the purpose/uses of run-time polymorphism? Is dynamic binding only way to achieve run-time polymorphism?
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.

 
Is this answer useful? Yes | No
September 15, 2009 17:51:58   #3  
sflebrun Member Since: November 2007   Contribution: 1    

RE: What is the purpose/uses of run-time polymorphism? Is dynamic binding only way to achieve run-time polymorphism?
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.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape