Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Polymorphism is an abstraction technique whose goal is substitutability. "Car extends Vehicle" is useful if other kinds of Vehicles can be substituted for cars.

"That's great", thinks the student, "I'll keep that in mind on the offchance I ever need to write code for an automatic carwash..."

Honestly I think these examples are fine as far as they go, but they should be immediately followed up with nontrivial examples demonstrating how you might actually use this in programming problems which don't fall into the category "simulation of real-world objects". Otherwise the student can easily dismiss the whole idea as esoteric.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: