日期:2014-05-18  浏览次数:20616 次

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);
}
}