Polymorphism ....Up-casting ....need help to understand a code....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alireza6485
    New Member
    • Jan 2009
    • 19

    Polymorphism ....Up-casting ....need help to understand a code....

    Hi,
    can u help me with polymorphism and up-casting please.
    Bipeds scream
    birds fly
    bird bd =new bied;
    Bipeds bp
    bp=bd(upcasting )//what does this line do?is it saying that the biped we have is a bird?
    bp.scream
    bd.scream
    bd.fly
    bp.fly (ERror) // why there is an error???bp=bd should not bp acts the same as bd???
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Please supply the actual code for the biped and bird classes so we can better determine why there was an error.

    Comment

    Working...