As far as i know it is not possible to do the following in C# 2.0
public class Father
{
public virtual Father SomePropertyName
{
get
{
return this;
}
}
}
public class Child : Father
{
public override Child SomePropertyName
{
get
{
return this;
}
}
}
I workaround the problem by creating the property in the derived class as "new", but of course that is not polymorphic.
public new Child SomePropertyName
Is there any solution in 2.0?
What about any features in 3.5 that address this matter?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…