• Solemarc@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    7 days ago

    You’re not wrong but I think when you’re teaching someone just having 1 parent and 1 child class makes for a bad example I generally prefer to use something with a lot of different children.

    My go-to is exporters. We have the exporter interface, the generic exporter, the accounting exporter and the payroll exporter, to explain it.

    At school, the only time I used inheritance was 1 parent (booking) and 1 child (luxury) this is a terrible example imo.