public
interface
greeting
...
{
void SayHello();
}

public
class
firstGreeting:greeting
...
{
greeting 成员#region greeting 成员
public void SayHello()
...{
MessageBox.Show("这是我的第一个版本");
}
#endregion
}


public
interface
NeedModify:greeting
...
{
void SetPreviousGeeting(greeting pregreet);
void SayGoodbye();
}

public
class
SecondGreeting:NeedModify
...
{
private greeting pre_greeting;
NeedModify 成员#region NeedModify 成员
public void SetPreviousGeeting(greeting pregreet)
...{
pre_greeting=pregreet;
}
public void SayGoodbye()
...{
MessageBox.Show("您好,再见");
}
#endregion

greeting 成员#region greeting 成员
public void SayHello()
...{
MessageBox.Show("这是我的第二个版本的你好");
this.SayGoodbye();
}
#endregion
}

public
class
GreetingInEnglish:NeedModify
...
{
private greeting pre_greeting;

NeedModify 成员#region NeedModify 成员
public void SetPreviousGeeting(greeting pregreet)
...{
pre_greeting=pregreet;
}
public void SayGoodbye()
...{
MessageBox.Show("这是英语的说再见");
}
#endregion

greeting 成员#region greeting 成员
public void SayHello()
...{
pre_greeting.SayHello();
this.SayGoodbye();
}
#endregion
}