logoalt Hacker News

bheadmasterlast Wednesday at 7:29 AM2 repliesview on HN

Inheritance is often used as an enabler for polymorphism in languages that don't support it in any other way.

Somehow, it leaked out and convinced everyone that it is a good thing on its own.


Replies

rhdunnlast Wednesday at 8:22 AM

There are two types of inheritance:

- interface/API based -- this is supported in modern languages via interfaces, traits, etc.

- implementation/code based -- modern languages tend to only support single inheritance; they tend to also support default method implementations on the interfaces/traits

show 2 replies
goatloverlast Wednesday at 8:11 AM

Also encapsulation and code reuse. Message passing if you go by the guy who coined the term.

show 1 reply