using System ; delegate int MyDelegate( ) ; class B { // 定义一个私有的函数: static int MyPrivateMethod() { return 0 ; } } public class A { // 字段定义: public B myField = new B();// 错误: 类型B与A字段A.myField级别不同 // 构造函数: public readonly B myConst = new B(); //错误: 类型B是仅读的 //方法: public B MyMethod() { return new B(); } //属性: public B MyProp { set { } } public static B operator + (A m1, B m2) { return new B(); } static void Main() { Console.Write("Compiled successfully"); } } |