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

what is inprocess and outprocess in vb

1 Answers   Msoft,


what is the purpose of postback?

2 Answers   Nth Solution,


Find out the list of authorization objects which contains activity as a field? Thanks in advance.

0 Answers  


what are other resources are needed for this mantis?

0 Answers  


how we can call xml file in java file using Android platform?

2 Answers   TCS,






What sysoption determines where the macro facility searches a specific catalog for complied macro?

0 Answers   GE,


In loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?

0 Answers  


Display names and numbers of employees who have 5 years or more experience and  salary less than Rs.15000 using array of structures (name, number, experience and  salary)

0 Answers  


how to get second highest salary from a employee table and how get a 5th highest salary from a employee table by using proc sql?

0 Answers   ABC,


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;

0 Answers  


what is the difference between read the data from table and infotype

0 Answers  


7.x=10; y=20; x<<2=? x<<1=? y>>2=?

1 Answers  


Categories