Posted: Mon Feb 25, 2013 8:00 pm Post subject: RE:OOP questions
Polymorphism is storing a subclass typed variable in a superclass typed variable. That was terrible wording. Look at my example:
code:
public class A{
//Not important
}
public class B extends A{
//Not important
}
So B is a subclass of A
Polymorphism is doing this:
A variableName = new B();
It's convenient when you have multiple subclasses of A and you want to interchange which subclass type the variable holds