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

> then a subclass is actually a supertype—a superset of the possible values of its parent class—and likewise a superclass is a subtype

I'm sure this makes sense and is well-though-out, but I just can't understand it. What difference does it make if `Dog < Animal` are classes or types? Still any dog is an animal and not any animal is a dog. Or am I missing something?



you're not missing something, I believe the comment just got it flipped, and was referring[1] to problems relating to covariance and contravariance, when one tries to view OOP in terms of type theory.

[1] http://en.wikipedia.org/wiki/Covariance_and_contravariance_(...




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

Search: