-3

Should composition be favoured over inheritance as rule - in all circumstances?

I have read that inheritance is actually now being seen as an anti pattern. My problem with that is that some relationships logically fit into inheritance i.e. is-a relationships.

But from reading lately this is seen as wrong?

What is the way to go with this?

4

1 回答 1

0

不,在所有情况下,组合都不应该优先于继承。您通常将它们用于不同的事情和不同的情况。

于 2013-06-22T21:40:49.410 回答