• Post Reply Bookmark Topic Watch Topic
  • New Topic

a test about casting  RSS feed

 
Domingo zhou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why the code "pogo = (SwampThing)wawa;" will cause runtime exception but not a complile time error.
i think,the "wawa" is Washer type thich is not relevant to the
hierarchy from "animal" to "Swampthing".so the explicit casting will cause
complile error.But im am wrong.
Why???
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!