C# base
来源:互联网 发布:知乎怎么看答谢 编辑:程序博客网 时间:2024/05/22 10:37
namespace temp
{
class Program
{
static void Main(string[] args)
{
temp2 t = new temp2(100);
t.showInfo();
Console.ReadLine();
}
}
class temp1
{
public temp1()//无参数的基类构造函数
{
Console.WriteLine("base no paramer");
}
public temp1(int fo)//有参数的基类构造函数
{
Console.WriteLine("base class");
}
public virtual void showInfo()//可重载的基类方法
{
Console.WriteLine("base method");
}
}
class temp2 : temp1//temp1的派生类
{
public temp2()
: base(100)//调用父类的带参数的构造函数
{
Console.WriteLine("child class no paramer");
}
public temp2(int fo)
: base()//调用父类的不带参数的构造函数
{
Console.WriteLine("child class");
}
public override void showInfo()//重载父类的 showinfo方法
{
base.showInfo();
Console.WriteLine("this child's method");
}
}
}
- C# base
- C# base
- base(C# 参考)
- C#中的base
- base(C# 参考)
- C# this base
- C# base和this
- C# base和this
- C# base和this
- C# base和this
- C# base和this
- C# base和this
- C# base和this
- C# virtual, base, override
- C# base 关键字
- base(C# 参考)
- C# base this的使用
- c# 中的base和this
- 网站入侵过程!
- 大家好
- 弹出窗口代码大全
- Lazarus实践 --- 访问SQL Server
- 剖析Linux病毒原型的工作过程和关键环节
- C# base
- IIS、ASP.NET和SQLServer的安全性问题
- /*****隱式事務*****/
- UNIX 的二十年发展史
- Java2游戏编程读书笔记(13-2)
- Excel Upload...
- How to become a programmer
- 克隆Shark,做一个适合CS系统的工作流产品
- 垂直搜索前途与命运的问题--复:爱游泳的鱼[原创]