在C#中将方法定义为protected
的好处是什么?
例如:
protected void KeyDemo_KeyPress( object sender, KeyPressEventArgs e )
{
// some code
}
相对于这样的东西:
private void FormName_Click( object sender, EventArgs e )
{
//some code
}
我在许多书籍中看到过这样的例子,但我不明白为什么和何时使用 private
与 protected
?