类的字段和静态字段的使用

 

 1 /*
 2  * 编写者: 且共从容
 3  * 日期: 2009-10-3
 4  */
 5 using System;
 6 using System.Collections.Generic;
 7 
 8 namespace app
 9 {
10  class A
11  {
12   public static int a=9;
13   public int b=0;
14  }
15  class MainClass
16  {
17   public static void Main(string[] args)
18   {
19    A t=new A();
20    Console.WriteLine("{0}",t.b);//实例访问
21    Console.WriteLine("{0}",A.a);//类访问
22    Console.ReadLine();
23   }
24  }
25 }
26 
27 

 

posted @ 2009-10-03 16:42  HeartLight  阅读(305)  评论(1编辑  收藏  举报