I am having the following problem:
I obtain an object from an external component and what I’d like to do is override several of the object’s functions in order to change parts of its behavior.
I tried doing this via a decorator by inheriting from the original object’s class and storing the original object as a member variable, but then I would have to override all the functions in that object.
I also don’t have access to most of the object’s internal data, so I cannot just clone it into my derived object’s base class.
So bottom line is: is there anyway to override a couple of an already instantiated object’s functions while retaining the data and not having to override the entire object functionality?
Thanks,
PM
The short answer is, No.
The longer answer is to write a wrapper around it and yes that means implementing all the methods. YOu can do this via composition.
.Net isn’t a dynamic language although it has some dynamic feature but I don’t think you component will be dynamic.