About polymorphism
Sorry for sending many questions but I will have an exam so ?have to.
My questions is that I think abstarct classes contribute polymorphism very much because they provide us to use an abstract method arbitrarily. So this means dynamic method binding, is not it ?
If I am false, please correct me.
[315 byte] By [
samue-1a] at [2007-10-2 15:19:30]

Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon.
Polymorphism allows a reference to denote objects of different types at different times during execution.
So Polymorphism is the result of dynamic method binding of overridden methods at runtime, and the binding is based on the actual type of the object, not the type of the reference.
Thanks for your reply.There is something make me confused in your reply.the binding is based on the actual type of the object, not the type of the reference.I could not keep the ieda that you tried to give.Would you mind being more clear ?
> the binding is based on the actual type of the object, not the type of the reference.
class A {
void printHello() {
System.out.println("Hello from A");
}
}
class B extends A {
void printHello() {
System.out.println("Hello from B");
}
}
A obj;
obj = new B();
obj.printHello();
// *** Even if declared type of obj is A, binding will be made on actual type of obj which is B.
// *** So the ouput will be: "Hello from B"