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 |
What is the difference between CriteriaQuery and CreateQuery in Hibernate???? Thanks in advance!!!!!!
What are the limitation in using querystring in .net?
what is the software to run the GSM gate opener program
Hello all, My name is Nrupali, am a fresher, i know C language beginner. dont have any experience. planning to learn Php. let me know which language should i choose to learn or for salary purpose and growth??? kindly help me to take decision. thanks
I want Ada programming language books. Could anyone post me any link for that?
Which method protects back button to retrieve old value from previous page in Struts.
I want sample papers for NIC Examination. Plz send them to my mail Id das.neelam@gmail.com . Plz send it today, tomorrow i've the exam.
what is an INI file?
What is Meaning of Windows Application & the use of Windows Applications? with Description.
differenc between visual studio 2005,2008 & 2010?
what is oops?
In Bioinformatics, a DNA sequence is made up of a combination of 4 characters, namely “A,C,G,T”. A subsequence of a given sequence of characters a0, a1, …an- 1, is any subset of the characters taken in order, of the form ai0 , ai1 ,…..aik-1 where 0 ≤ i0 <i1….< ik-1 ≤ n-1. For example in the sequence “A,C,G,T,G,T,C,A,A,A,A,T,C,G”, we can have subsequences “A,G,T”, “A,C,A,A” and many more. A subsequence is palindromic if it is the same whether read left to right or right to left. For instance, the sequence “A,C,G,T,G,T,C,A,A,A,A,T,C,G”, has many palindromic subsequences, including “A,C,G,C,A” and “A,A,A,A” (on the other hand, the subsequence “A,C,T” is not palindromic). Devise an algorithm (using dynamic programming) that takes a sequence of characters X[0 … n-1] from the alphabet set (A,C,G,T) and returns the (length of the) longest palindromic subsequence. Implement the algorithm in an appropriate language.