摘要:
抽象类不能直接实例化: using System; abstract class MyClass { } class Program { static void Main() { /* 抽象类不能直接实例化, 下面这样会出错 */ MyClass obj = new MyClass(); Console.ReadKe... 阅读全文
posted @ 2009-01-02 23:40
万一
阅读(2070)
评论(0)
推荐(0)
摘要:
构造函数与析构函数: using System; class MyClass { private int FNum; public int Num { get { return FNum; } } /* 构造函数没有返回值, 无参的构造函数是默认的 */ public MyClass() { this.FNum = 2009; ... 阅读全文
posted @ 2009-01-02 20:36
万一
阅读(2726)
评论(0)
推荐(0)
摘要:
继承: using System; class Parent { public void Msg() { Console.WriteLine("Parent"); } } class Child : Parent { } class Program { static void Main() { Parent ObjParent = new Paren... 阅读全文
posted @ 2009-01-02 16:45
万一
阅读(2465)
评论(1)
推荐(0)
摘要:
所有类默认继承于 System.Object(或叫 Object): using System; class MyClass1 { } class MyClass2 : Object { } class MyClass3 : System.Object { } class Program { static void Main() { MyClass1... 阅读全文
posted @ 2009-01-02 14:49
万一
阅读(2790)
评论(0)
推荐(0)
浙公网安备 33010602011771号