示例#1
0
            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);
            }
示例#2
0
        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);
        }