//父类:
using System;namespace TestInherit
{
public class Father
{
public int father_a=111;
public int father_aa=1111;
public readonly int father_c=7777;
public static int father_e=222;
public static int father_ee;
static Father()
{
father_e=5555;
father_ee=3333;
} public Father()
{
father_ee=4444;
}
public Father(int a)
{
father_a=a;
}
}
}子类
using System;namespace TestInherit
{
public class Son:Father
{
public int son_int=9999;
public static int son_b=111;
public static int son_c;
public Son()
{
son_c=222;
}
static Son()
{
son_c=333;
}
public Son(int a)
{
son_int=a;
}
}
} 测试类:
using System;
namespace TestInherit
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Son son1=new Son ();
}
}
}
顺序:
1.子类静态变量;
2.子类静态构造函数;
3.子类非静态变量;
4.父类静态变量;
5.父类静态构造函数;
6.父类非静态变量;
7.父类无参构造函数;
8.子类无参构造函数;
以上顺序对吗?
所以又了此问
namespace TestInherit
{
public class Father
{
public int father_a=111;
public int father_aa=1111;
public readonly int father_c=7777;
public static int father_e=222;
public static int father_ee;
static Father()
{
father_e=5555;
father_ee=3333;
Console.WriteLine("father-static");
} public Father()
{
father_ee=4444;
Console.WriteLine("father-Non Static-non parameter");
}
public Father(int a)
{
father_a=a;
Console.WriteLine("father-Non Static :" + a.ToString());
}
}
public class Son : Father
{
public int son_int = 9999;
public static int son_b = 111;
public static int son_c;
public Son()
{
son_c = 222;
Console.WriteLine("child-Non Static-non parameter");
}
static Son()
{
son_c = 333;
Console.WriteLine("child- Static-non parameter");
}
public Son(int a)
{
son_int = a;
Console.WriteLine("child-Non Static:" + a.ToString());
}
}
class Program
{
static void Main(string[] args)
{
Son s = new Son();
Console.ReadKey();
}
}}
我就是在纳闷,断点设置了,怎么调试,又不可能把这个cs文件设置成启动项,我只能用csc把这个文件编译成exe文件,到时再控制台打出来到时可以,就是不晓得设断点怎么跟踪
编写完程序时
设置断点之后
安“F11”直接进行跟踪啊
就是这个样子啊