"Daniel" <Da*****@vestry online.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Can i ask then....
How would you then tell a generic animal object later that it is now a dog
object?
If you initially created the object as a generic animal, you can't. The
type of an object cannot change during its lifetime. If it wasn't a Dog to
start with, it will never be a Dog.
If you like, you can create a Dog class that takes as a parameter to the
constructor an Animal instance, and then copies the information from that
Animal to a *new* Dog instance. That would allow you a way to create a
*new* Dog that inherits the generic characteristics of the Animal instance
you have (or the Animal-specific characteristics of any other Animal-derived
class, for that matter). But you cannot change a generic Animal instance
that isn't already a Dog into a Dog.
Pete