• Kache@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 hours 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.