what is run time polymorphism

Answer Posted / shiry

In C++ ;
if i have 2 clases
class A {

int x();
}
class B : public A {

int x();
}
void main(){

A* a = new B() ;
a.x(); // it will call the method of the super class A
// not B but in java it will call the method in the
// child B why ??

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

is it possible to instantiate the math class?

522


what do you mean by stream pipelining in java 8? Explain

529


What are use cases?

558


Write code to implement bubble sort in java?

553


What is private static in java?

573






Are floats faster than doubles?

559


What is default constructors?

535


How do I get 64 bit java?

519


Which arithmetic operations can result in the throwing of an arithmeticexception?

595


What is difference between length and length() method in java ?

555


What is the differences between heap and stack memory in java? Explain

527


What does this mean java?

552


Is object a data type?

552


Explain wait() method of object class ?

627


What are the advantages of arraylist over arrays?

563