看看这个场景:
//base class
abstract class AAA { }
//class 1
class BBB : AAA
{
//Field of ZZZ type
public ZZZ ZField = new ZZZ();
}
//class 2
class ZZZ
{
public string foo() { return ImAPropertyOfAnAAADerivedClass ? "yes" : "no"; }
bool ImAPropertyOfAnAAADerivedClass
{
get { /* here */ }
}
}
//running test
new BBB().ZField.foo(); // => expected "yes"
new ZField.foo(); // => expected "no"
我的问题是:
有没有办法实现ImAPropertyOfAnAAADerivedClass
?