Home  /  Questions  /  Question



69   95.9
Mar 31, 2011


Refactoring: Replace Inheritance by Delegation

I read that in the Refactoring literature that one of its approaches is to replace Inheritance by Delegation.  Supposedly, when using inheritance it is more difficult to make changes.  From experience I see that this is indeed the case.

However, if you look at for example WPF class libraries you'll find an inheritance tree that is incredibly deep and complex; sometimes up to 10-12 levels deep. 

My question is this: why is it that Microsoft does it this way and not use delegation more frequently?