我有一個product.aspx類C#保護關鍵字相關的問題
public partial class _Products : Product
{
protected void Page_Load(object sender, EventArgs e)
{
Product p1 = new Product();
p1.m1(); ///here I am facing problem y intelligence system not allowing me access the product class method m1();
}
new virtual int m1()
{
return 10;
}
}
,在我AppCode我有一個類product.cs
public class Product
{
public Product()
{
//
// TODO: Add constructor logic here
//
}
protected void m1()
{
}
public void m2()
{
}
裏邊反問題是,p1.m1() ;在這裏我面臨的問題是我的智能系統不允許我訪問產品類的方法m1();
參見:http://blogs.msdn.com/b/ericlippert/archive/2005/11/09/why-can-ti-access-a-protected-member-from- a-derived-class.aspx – 2010-11-28 08:51:13