Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


What do you meant by Runtime Polymorphism?

Answers were Sorted based on User's Feedback



What do you meant by Runtime Polymorphism?..

Answer / pankajbisane

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

What do you meant by Runtime Polymorphism?..

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

Post New Answer

More Programming Languages AllOther Interview Questions

which book we learned this mantis? how many version are realsed this mantis upto now?

0 Answers  


Which tag is used to break a line

3 Answers  


In java without use of main() how to execute the program

0 Answers  


iam confused to choose among testing, .net and java can anybody help me????????

0 Answers  


how many keywords are present in "c"?

18 Answers   Assurgent, Cynosure Software, IBM,






what is the use MDM(Master Data Management)and meaning

0 Answers  


I want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...

0 Answers  


What is abstract Method i want the exact definition and is there any possibility to declare class as abstract without any abstract methods in that class?If it is possible then tell me why and how?

0 Answers  


How can successful and thorough systems planning, analysis, and design be ruined by poor systems construction and implementation? How can poor systems analysis or design ruin a smooth construction and implementation? For both questions, list some consequences

1 Answers  


How to rename A1-A30 datasets into B1-B30 using macros?

1 Answers   Icon,


What is meant byStatic Variable ?

7 Answers   Mascot,


can we allocate memory for interface? if no then why?

0 Answers  






Categories