首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-02-20 
class b:a 是什么意思啊?classA{protectedintx123}classB:A{voidF(){AanewA()BbnewB()a.x10//Erro

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

热点排行