Is Inheritance really needed?

后端 未结 22 2140
孤街浪徒
孤街浪徒 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:23

    There are a lot of features in a programming language that are not really needed. But they are there for a variety of reasons that all basically boil down to reusability and maintainability.

    All a business cares about is producing (quality of course) cheaply and quickly.

    As a developer you help do this is by becoming more efficient and productive. So you need to make sure the code you write is easily reusable and maintainable.

    And, among other things, this is what inheritance gives you - the ability to reuse without reinventing the wheel, as well as the ability to easily maintain your base object without having to perform maintenance on all similar objects.

提交回复
热议问题