• StrikeForceZero@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    2 days ago

    Yeah Interfaces would be the next best thing.

    The only reason why traits are considered better is because in languages like rust it can enable static dispatch. Whereas interfaces in C#, Java, Typescript, (and C++ via abstract classes, not templates) are always dynamic dispatch.