Deriving an abstract class from concrete class

后端 未结 7 830
囚心锁ツ
囚心锁ツ 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:32

    Not necessarily wrong, but definitely smelly. Especially if you leave the fruit out in the sun for too long. (And I don't think my dentist would like me eating concrete apples.)

    Though, the main thing I see here that's smelly isn't so much the abstract class derived from a concrete class, but the REALLY DEEP inheritance hierarchy.

    EDIT: re-reading I see that these are two hierarchies. All the fruit stuff got me mixed up.

提交回复
热议问题