Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Polymorphism.........

This is a discussion on Polymorphism......... within the Java forums, part of the Software Development category; What is Compile time polymorphism and Runtime polymorphism?...

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-08-2007
Junior Member
 
Join Date: Jun 2007
Location: Chennai
Posts: 25
Thanks: 9
Thanked 1 Time in 1 Post
Sampath_Java is on a distinguished road
Thumbs up Polymorphism.........

What is Compile time polymorphism and Runtime polymorphism?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-10-2007
Junior Member
 
Join Date: Sep 2006
Location: Pune, India
Posts: 10
Thanks: 1
Thanked 1 Time in 1 Post
lhariPrasad is on a distinguished road
Re: Polymorphism.........

the overloaded methods can be called compile time.... inheritance and virtual functions can be called as runtime polymorphism.
Guys please start a discussion on this.
Does any one have an idea on the various categories and varieties of polymorphism ?
Reply With Quote
The Following User Says Thank You to lhariPrasad For This Useful Post:
  #3 (permalink)  
Old 09-11-2007
Banned
 
Join Date: Nov 2005
Posts: 45
Thanks: 1
Thanked 7 Times in 6 Posts
ejazazeem79 is on a distinguished road
Re: Polymorphism.........

Well, let me put some words for polymorphism here . . .

Runtime polymorphism come into play when compiler delay the binding of objects to its data members until runtime, sometimes called late binding.

so

if we have

class A{
public methodA(){..}
}

class B extends A{
public methodA(){..}
}

and the code

A a = new B();

here a will be calling the Bs implementation of methodA() and this is decided at runtime.
Reply With Quote
The Following 2 Users Say Thank You to ejazazeem79 For This Useful Post:
  #4 (permalink)  
Old 09-11-2007
Contributing Member
 
Join Date: Sep 2006
Location: bangalore, india
Posts: 1,016
Thanks: 0
Thanked 89 Times in 72 Posts
psuresh1982 will become famous soon enough
Re: Polymorphism.........

Using method overloading u can acheive the compile time polymorphism. It means Compiler knows at the compile time which object assigned to which class.

Using method overridding u can acheive the run time polymorphism. It means Compiler didn't know the compile time and it knows only at the run time.

In our forum we already discuss about this one...If you want more details go through the following URL...

Polymorphism

----------------------
suresh
Reply With Quote
The Following 2 Users Say Thank You to psuresh1982 For This Useful Post:
  #5 (permalink)  
Old 09-12-2007
Junior Member
 
Join Date: Sep 2007
Location: Bangalore
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
user9 is on a distinguished road
Re: Polymorphism.........

Quote:
Originally Posted by Sampath_Java View Post
What is Compile time polymorphism and Runtime polymorphism?
Polymorphism refers to the similarity among several functions by the same name.However, the compiler makes the distinction among them either at the compile time (before the program is run) or at the run time(program has become a process). At compile time the distinction is made with the types and number of parameters the same name function has, as such its also called early binding. The Run time Polymorphism(binding) is done for the functions which are virtual,where the distinction can't be made on the basis of types or nume of functions and the base class pointer can refer to the derived class functions(same name).This is done with the help of Virtual Table.
Reply With Quote
The Following User Says Thank You to user9 For This Useful Post:
Reply

  Geeks Talk > Software Development > Java

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Polymorphism kalayama OOPS 10 10-02-2008 01:49 AM


All times are GMT -4. The time now is 09:57 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved