Hi guys Just wondering if there is any way to do the following:
public Interface IDataField
{
object GetValue();
}
public Interface IComplexDataField : IDataField
{
object GetDefaultValue();
}
public class MyBase
{
private IDataField _DataField;
public MyBase()
{
this._DataField = this.CreateDataField();
}
public virtual IDataField CreateDataField()
{
return new DataField(); //Implements IDataField
}
**public virtual IDataField GetDataField()**
{
return this._DataField;
}
public void SomeMethod()
{
this.GetDataField().GetValue();
}
}
public class MyComplexBase : MyBase
{
public override IDataField CreateDataField()
{
return new ComplexDataField(); //Implements IComplexDataField which Implements IDataField
}
**public override IComplexDataField GetDataField()**
{
return (IComplexDataField)base.GetDataField();
}
public void SomeComplexSpecificMethod()
{
this.GetDataField().GetValue();
this.GetDataField().GetDefaultValue();
}
}
Cheers Anthony