当前位置: 代码迷 >> ASP.NET >> class b:a 是什么意思啊解决方法
  详细解决方案

class b:a 是什么意思啊解决方法

热度:655   发布时间:2013-02-25 00:00:00.0
class b:a 是什么意思啊?
class A  
  {  
  protected int x = 123;  
  }  
   
  class B : A  
  {  
  void F()  
  {  
  A a = new A();  
  B b = new B();  
  a.x = 10; // Error  
  b.x = 10; // OK  
  }  
  }  

这里的class B : A 是什么意思啊? - - 不要笑我哦

------解决方案--------------------------------------------------------
说明类B是继承于类A的

------解决方案--------------------------------------------------------
你这个例子对你来说可能难了点

class A
{
prtected int x=5;
}

class B:A
{
protected int y=6;
}

class c
{
  
static void main(string args[])
{
B test=new B();
console.write(test.x);
console.write(test.y);
}
}
 
  相关解决方案