//zhangzhicong 2007-03-10
using System;
using System.Collections.Generic;
using System.Text;
namespace t070309
{
class Program
{
static void Main(string[] args)
{
b bb = new b();
Console.ReadKey();
}
}
public class a
{
//无参数,最好要定义一个无参数的构造函数,这是很好的习惯
public a()
{
Console.WriteLine("a init null");
}
//一个参数
public a(string m)
{
Console.WriteLine("a init m={0}.", m);
}
//两个参数
public a(string m,string n )
{
Console.WriteLine("a init m={0},n={1}.", m,n);
}
}
public class b : a
{
private static string m = "zhangzhicong";
private static string n = "man";
/*
* 说明:类A已经自定义了 无参数构造函数,即在调用基类的构造函数,
* 问题在于,基类的默认构造函数已经不存在,即要调用基类的自定义
* 构造函数了,这里使用了base(),在这里确定要调用的构造函数
* */
public b():base()
{
Console.WriteLine("b init null.");
}
}
}