C程序的相关设计基础.pptVIP

  • 0
  • 0
  • 约1.66万字
  • 约 65页
  • 2020-10-30 发布于广东
  • 举报
关键字static 案例名称:使用static关键字 程序名称:2-28.cs ? using System; public class Person { private int id; public static int total = 0; public Person() { total++; id = total; } } public class OtherClass { public static void Main() { Person.total = 100; Console.WriteLine (Person.total); Person c = new Person(); Console.WriteLine (Person.total); } } 案例名称:使用静态方法 程序名称:2-29.cs ? using System; public class Person { private int id; private static int total = 0; public static int getTotalPerson() { return total; } public Person() { total++; id = total; } } public class TestP

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档