How do you implement the Decorator pattern if you can't inherit from the class you want to decorate?

Posted by Lennie on Stack Overflow See other posts from Stack Overflow or by Lennie
Published on 2010-05-08T14:40:34Z Indexed on 2010/05/08 14:58 UTC
Read the original article Hit count: 129

Filed under:

Hi, This is more a design question... You can't do a decorate design pattern if:

1) The object is marked "sealed" meaning you can't extend from it. 2) or you want to override a method but its not virtual.

What can you do then? Taken that you can't change the class source code if you don't have the source code (like a 3rd party library).

© Stack Overflow or respective owner

Related posts about c#