Another reason would be if you don't know what the object will be when coding.
Set up for the following code is, you have a base class Animal. You have methods walk, sleep, and eat. Then two more classes are added, a Cat class and a Dog class, they extend from the Animal class. Now in this example you may override one, two or all the methods from your base class, but to make this example make complete sense, both animals walk and sleep the same, which they will inherit from the base class, but they eat differently, (the cat eats wet food from a can, the dog eats dry food from a bag.) (This gives you a reason to even have the 2 other classes, but yet extend from the Animal)
Otherwise your if...else condition would be rather large. And you would be faced with (everyone gasps) clipboard inhertance.
Hopefully I spelled everything right!!!
Michael Waites
[This message has been edited by Michael Waites (edited April 27, 2001).]
[This message has been edited by Michael Waites (edited April 27, 2001).]
[This message has been edited by Michael Waites (edited April 27, 2001).]