Should inheritance (of non-interface types) be removed from programming languages?

前端 未结 20 2161
旧时难觅i
旧时难觅i 2020-12-30 05:20

This is quite a controversial topic, and before you say \"no\", is it really, really needed?

I have been programming for about 10 years, and I can\'t honestly sa

20条回答
  •  一生所求
    2020-12-30 05:37

    Have fun implementing ISystemObject on all of your classes so that you have access to ToString() and GetHashcode().

    Additionally, good luck with the ISystemWebUIPage interface.

    If you don't like inheritance, my suggestion is to stop using .NET all together. There are way too many scenarios where it saves time (see DRY: don't repeat yourself).

    If using inheritance is blowing up your code, then you need to take a step back and rethink your design.

    I prefer interfaces, but they aren't a silver bullet.

提交回复
热议问题