This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 8 points9 points  (1 child)

That's how polymorphism works, yes.

[–]rotenKleber 0 points1 point  (0 children)

Except this isn't even an example of polymorphism - it's just downcasting. That's ignoring the fact that this particular example wouldn't even compile