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 |
HOW TO DOWNLOAD ORCUT SITE VIDEOS IN PC WITH THE HELP OF MOZILL'S FIREFOX?
What is the difference between: x=a+b+c+d; and x=SUM(a,b,c,d);?sas
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.
DIFFERENCE BETWEEN BINDING LANG AND BIND DIR WHEN USING IN SERVICE PGM
10.Define filters,binary to hexadecimal,hexadecimal to decimal?
When will you use shell script/Perl ahead of C/C++?
Can i please VHDL code for D-Latch with clear input ?? (HINT: Set up a “Process” with appropriate sensitivity list to get the desired D-Latch with Clr working.) Inputs and Outputs: entity Lab4b is Port ( Clr, Clk, D : in STD_LOGIC; Q : out STD_LOGIC); end Lab4b;
1. What coding languages are you comfortable with?
what is the system development cycle
sample and simple coding where we get?
kindly send interview materials
What are data structures?