现在的位置: 首页 > 综合 > 正文

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

2012年02月22日 ⁄ 综合 ⁄ 共 408字 ⁄ 字号 评论关闭

 

 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 

 

抱歉!评论已关闭.