日期:2014-05-20 浏览次数:20819 次
public class Father
{
protected bool focus = false;
public void SetFocus(bool fo)
{
this.focus = fo;
}
private Child _child;
public Child Child
{
get
{
if (_child == null)
{
return new Child();
}
return _child;
}
set
{
if (_child == null)
{
_child = new Child();
}
_child = value;
}
}
}
public class Child : Father
{
public bool GetFoucValue()
{
return base.focus;
}
}
private void button1_Click(object sender, EventArgs e)
{
//Child child = new Child();
//child.SetFocus(true);
//bool oo = child.GetFoucValue();
Father father = new Father();
father.SetFocus(true);
bool err = father.Child.GetFoucValue();
}