What do you meant by Runtime Polymorphism?
Answer Posted / 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 View All Answers
can we extend a class having only one parameterised constructor.Suggest the process to do it.
when we use mantis? how learn mantis?
what is web configuration file
Delta 5 weight scale not connect with oracle application what i can do?
What is Negative testing?
Define Form modules, Class modules and Standard modules
Explain what is OOPS and its concepts?
any drawback are there in mantis?
I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.
Give examples of macro quoting function?
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
How to connect the .accdb database file of microsoft access to the Visual Basic 6.0 forms?
what are the topics choosen for jam round for interviews
Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.
Is the IT field raise again? What is the position of IT after 4 years?