this post was submitted on 14 Nov 2024
72 points (95.0% liked)

Programmer Humor

19557 readers
413 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Kache@lemm.ee 1 points 2 hours ago* (last edited 1 hour ago)

inheritance to avoid code duplication

What no, inheritance is not for code sharing

Sound bite aside, inheritance is a higher level concept. That it "shares code" is one of several effects.

The simple, plain, decoupled way to share code is the humble function call, i.e. static method in certain langs.