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

关于继承的有关问题

2012-03-22 
关于继承的问题class A{public void A(int x,int y){//....}}class B:A{public voidB(int x,int y):base(x

关于继承的问题
class A
{
public void A(int x,int y)
{
//....
}
}
class B:A
{
public void B(int x,int y):base(x,y)
{
//....
}
}
书上说,C#提供了base关键字来访问基类中的成员,这里的x,y并不是基类A中的成员,怎么说是继承那?
请各位赐教

[解决办法]
class A 

public void A(int x,int y) 

console.writeline("it's A");


class B:A 

public void B(int x,int y):base(x,y) 

console.writeline("it's B");

}

B b=new B(0,0);

你看看效果
  
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 

http://feiyun0112.cnblogs.com/

热点排行