Let\'s assume I have a business case I want to use some model to represent a master-child structure. And there will be certain classes to inherit from both the master class and
Generics + potentially non-generic base class for your "with children" type is the standard solution. If you don't need BaseMaster
to be assignment-compatible between different types of child nodes you can remove base non-generic class.
Something roughly like following:
public class BaseMaster
{
public ReadOnlyCollection Children { get; }
}
public class BaseMaster : BaseMaster where T: BaseChild
{
public new IEnumerable Children { get
{
return base.Children.Cast();
};
}
}