构造函数 面试
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
//输出的结果是ABAB
class Program
{
static void Main(string[] args)
{
a a = new b();
b b = new b();
// c c = new a();//这样调是错的
}
}
public class a
{
public a()
{
Console.WriteLine("a");
Console.Read();
}
}
public class b:a
{
public b()
{
Console.WriteLine("b");
Console.Read();
}
}
public class c : a
{
c()
{
Console.WriteLine("c");
}
}
}