posted 18 years ago
Let's change the names of your classes a bit, then it will become more clear why this doesn't work.
Dog --- extends --> Animal
Cat --- extends --> Animal
If you have a Dog, can you cast it to a Cat - in other words, if you have a Dog, can you pretend that it's a Cat? No, you can't, because a Dog simply isn't a Cat.
(Remember that inheritance means "is a"; a Dog is an Animal, and a Cat is an Animal).