首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

单利形式的应用

2012-12-25 
单利模式的应用using System using System.Collections.Generic using System.Text namespace WindowsA

单利模式的应用

using System; using System.Collections.Generic; using System.Text; namespace WindowsApplication1 {     public class Test     {         private static Test test;//已本类为属性的一个静态属性。         //构造私有 其他类无法用new实例化。         private Test()         {         }          //以本类为返回值的静态方法。调用该方法是创建本类的单例对象         public static Test jia()         {             if (test == null)             {                 test = new Test();             }             return test;         }     } } 

?

?

?

热点排行