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. |
This is a discussion on Polymorphism......... within the Java forums, part of the Software Development category; What is Compile time polymorphism and Runtime polymorphism?...
|
|||||||
|
|||
|
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 ? |
| The Following User Says Thank You to lhariPrasad For This Useful Post: | ||
|
|||
|
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. |
| The Following 2 Users Say Thank You to ejazazeem79 For This Useful Post: | ||
|
|||
|
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 |
| The Following 2 Users Say Thank You to psuresh1982 For This Useful Post: | ||
|
|||
|
Re: 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.
|
| The Following User Says Thank You to user9 For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Polymorphism | kalayama | OOPS | 10 | 10-02-2008 01:49 AM |