单例模式 只能实例化一次

 private static AnimationManager _this;//当前的对象,并且只有一个

    public static AnimationManager _This {
        get {
            return _this;
        }
    }

 

private static Song _song;
public static Song _Song{
get {
  if(_song==null){
_song=new Song();
}  
return _song;
}
}

单例可以方便的通过类名访问到那个唯一的实例进行操作

posted @ 2014-03-27 11:00  古刹红罗  阅读(442)  评论(0)    收藏  举报