I am working with an effectively third-party library. This library has a base class that's used as the interface (C++ style), ComponentBase
. ComponentBase
has a number of methods and setters that are implemented by its derived classes. In particular, right now I am interested in one specific item there: the Value
property (which has a public get
and a protected set
), effectively an array.
e.g.
public abstract class ComponentBase
{
// stuff we don't care about
protected Value m_Value;
public Value ValueObj { get; protected set; }
}
public class Value
{
private object[] m_Value;
public virtual object this[int Index]
{
get; set;
}
}
I need to add specific behaviour so that something happens when the values inside Value
are changed. As can be seen, I'd need to somehow change the get/set implementation.
I fail to see how to do so, however. How can that be accomplished?
Best Answer
I understand you simplified things in order to focus on your issue at hands.
You did well, imo, but left some blanks (in the Value class) I had to fill in, while trying to make as few / little assumptions as possible.
Following just plain, good old OOP principles, here's what you may find useful:
'HTH,