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

前端 未结 20 2279
旧时难觅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:25

    Note that inheritance means it is no longer possible to supply the base class functionality by dependency injection, in order to unit test a derived class in isolation of its parent.

    So if you're deadly serious about dependency injection (which I'm not, but I do wonder whether I should be), you can't get much use out of inheritance anyway.

提交回复
热议问题