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

Explain about sets?

659


What are thread local variables?

655


What is difference between c++ and java ?

761


Does java set allow duplicates?

623


When arithmeticexception is thrown?

677






How many times finalize method will be invoked? Who invokes finalize() method in java?

671


What is the final keyword denotes?

766


What are the differences between Java 1.0 and Java 2.0?

1754


What is finalize()?

720


What is class variable java?

666


What is an immutable class?

713


How does a for loop work java?

645


What is the purpose of a parameter?

629


Explain constructors and types of constructors in java.

733


What 5 doubled?

614