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