private static Hashtable ht; // 使用Hashtable来存储享元对象,充当享元池 private IgoChessmanFactory() { ht = new Hashtable(); IgoChessman blackChess = new BlackIgoChessman(); ht.Add("b", blackChess); IgoChessman whiteChess = new WhiteIgoChessman(); ht.Add("w", whiteChess); }
private static Hashtable ht; //使用Hashtable来存储享元对象,充当享元池 private IgoChessmanFactory() { ht = new Hashtable(); IgoChessman black, white; black = new BlackIgoChessman(); ht.Add("b", black); white = new WhiteIgoChessman(); ht.Add("w", white); }