//Instead of composition, I'd like to use inheritance in this case, because I'm only
//extending the basic functionality of the base class and I'm trying to reduce
//the amount of work that needs to be done.
//An XML file with static data is used for querying and conveying definitions eg.:
//Objects are created to assist in querying the XML eg.:
public class Data
{
protected internal Data(){}
private string _name;
public string Name{ get{ return _name; } internal set{ _name = value; }}
private string _value;
public string Value{ get{ return _value;} internal set{ _value = value;}}
}
public class Reader
{
public Reader(){}
public Reader(string xmlUri){...}
//etc...
public ICollection GetData(){}
//etc...
}
//Now along comes a user interface...
//The XML is extended to add additional attributes(visible,readonly) for UI purposes eg.:
//the objects are extended
public class DataEx : Data
{
protected internal DataEx() : base(){}
private string _readOnly;
public string ReadOnly { get{ return _readOnly; } internal set{ _readOnly = value; }}
}
public class UIReader : Reader
{
//In order to get this to work properly, I have to shadow the base
//class's GetData method and do alot of work on reimplementing
//the method and then populating DataEx(the extended version of Data)
public ICollection GetData(){ //lots-o-damn code ...}
}