1 using System; 2 /// <summary> 3 /// 命名空间 4 /// </summary> 5 namespace myspace 6 { 7 /// <summary> 8 /// 命名空间中的类 9 /// </summary> 10 class myclass 11 { 12 13 static void Main(string[] a) 14 { 15 //string[] mybook = new string[] { "mybook1", "mybook2" }; 16 //Console.WriteLine("HelloWorld," + a[0]); 17 //Console.ReadLine(); 18 //初始化类对象o 19 object o = new object(); 20 21 IPhone IP = new IPhone(); 22 23 } 24 /// <summary> 25 /// 类中的方法 26 /// </summary> 27 string Test() 28 { 29 return ""; 30 } 31 32 int T1() 33 { 34 return 0; 35 } 36 37 bool T2() 38 { 39 return true; 40 } 41 void T3() 42 { 43 44 } 45 } 46 /// <summary> 47 /// 公有类IPhone,XXX 48 /// </summary> 49 public class IPhone 50 { 51 /// <summary> 52 /// 类的构造函数,类初始化时调用该函数 53 /// </summary> 54 public IPhone() 55 { 56 Console.WriteLine("我是类IPhone的构造函数"); 57 } 58 59 public void myclass() 60 { 61 } 62 63 void my() { } 64 } 65 }
时间: 2024-10-21 14:02:29