J
John Wood
Let's say you're provided with an instance of a class. The instantiation
takes place in another module that you have no control over.
However, you've extended that class with your own value-added functionality.
In C#, given such an instance, and a derived class, there's no way to
'attach' the instance to the class -- you have to either change the way the
class was instantiated (not possible in this case), or wrap the class and
delegate each function (a concept known as aggregation).
I'm sure I've asked this question on the group before, and I settled for
aggregation. But I just don't like it.
I was wondering if anyone had any thoughts on this... ideas of more elegant
work-arounds / design patterns... solutions in other languages etc.
Thanks.
takes place in another module that you have no control over.
However, you've extended that class with your own value-added functionality.
In C#, given such an instance, and a derived class, there's no way to
'attach' the instance to the class -- you have to either change the way the
class was instantiated (not possible in this case), or wrap the class and
delegate each function (a concept known as aggregation).
I'm sure I've asked this question on the group before, and I settled for
aggregation. But I just don't like it.
I was wondering if anyone had any thoughts on this... ideas of more elegant
work-arounds / design patterns... solutions in other languages etc.
Thanks.