Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a test about casting

 
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