What do you meant by Runtime Polymorphism?
Answers were Sorted based on User's Feedback
Runtime polymorphisms means the code is called at run time
according to need or given conditions.
suppose there r two methods namely Add() one in super class
and other is in sub class.both have the same name and same
parameters.
so we have to choose that which method from them should
called at run time i.e. of super class or of sub class.
It can be achieved through the use of virtual functions.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / swe
In runtime polymorphism ... the code is called at run time according to need or given conditions.
suppose there r two methods namely Add() one in super class and other is in sub class.both have the same name and same parameters.
so we have to choose that which method from them shld called at run time i.e. of super class or of sub class.by polymorphism we do that.
ex:-
class A
{
int add(){//code of the method}
//some other code
}
class B extends A
{
int add(){//code of the method}
//some other code
}
class AB
{
public static void main(String s[])
{
A ob1;
ob1 new A();
int i ob1.add();//will call the method of super class.
ob1 new B();// sub class's reference can be assigned to super class address but not vice versa.to do that we have to type cast the reference of the sub class in reference of the super class.
int j ob1.add();//will call the method of sub class
}
| Is This Answer Correct ? | 1 Yes | 1 No |
why applet is introduced?
How to set on/off a group of indicators in a single statement?
what is adodb??y it is used for connection of V.B and access??what is ado?dao?
Why did you ever become involved in QA/testing?
What is the Difference between in memory database and physical database
If i have a dataset queried from Sql and I would like to insert the dataset into a specific node in an xml document how do I do this
what is the basic and unique feature of dotnet
what is the system development cycle
In an customer exit (include Z) program, only the last record is getting fetched. The exit is getting called after pressing save button. What to write for fetching the first record ? Before saved to a SAP table how can i call all these records in an itab in the exit ?
kindly send interview materials
why not instantiating servet using new operator?
what is the difference between SCAN AND CHECK,LOKUP AND XFOOT? where we can use thease opcodes? Can any body tell me real time senariao with example?