Deriving an abstract class from concrete class

后端 未结 7 838
囚心锁ツ
囚心锁ツ 2021-02-05 16:05

Let\'s say we have a concrete class Apple. (Apple objects can be instantiated.) Now, someone comes and derives an abstract class Peach from Apple. It\'

7条回答
  •  春和景丽
    2021-02-05 16:25

    It would seem to me like an indication of a bad design. Could be forced if you wanted to take a concrete definition from a closed library and extend it and branch a bunch of stuff off it, but at that point I'd be seriously considering the guideline regarding Encapsulation over Inheritance.. If you possibly can encapsulate, you probably should.

    Yeah, the more I think about it, this is a Very Bad Idea.

提交回复
热议问题