Is Inheritance really needed?

后端 未结 22 2165
孤街浪徒
孤街浪徒 2020-12-14 00:20

I must confess I\'m somewhat of an OOP skeptic. Bad pedagogical and laboral experiences with object orientation didn\'t help. So I converted into a fervent believer in Visua

22条回答
  •  渐次进展
    2020-12-14 01:05

    Inheritance is an implementation decision. Interfaces almost always represent a better design, and should usually be used in an external API.

    Why write a lot of boilerplate code forwarding method calls to a composed member object when the compiler will do it for you with inheritance?

    This answer to another question summarises my thinking pretty well.

提交回复
热议问题