예제 #1
0
        static void Main(string[] args)
        {
            WebsiteFactory f  = new WebsiteFactory();
            Website        fx = f.GetWebsiteCategory("产品展示");

            fx.Use(new User("小菜"));
            Website fy = f.GetWebsiteCategory("产品展示");

            fy.Use(new User("大鸟"));
            Website fz = f.GetWebsiteCategory("产品展示");

            fz.Use(new User("老顽童"));
            Website fm = f.GetWebsiteCategory("博客");

            fm.Use(new User("桃谷六仙"));
            Website fn = f.GetWebsiteCategory("博客");

            fn.Use(new User("南海鳄神"));
            Console.WriteLine("网站分类总数为:{0}", f.GetWebsiteCount());

            string title1 = "da";
            string title2 = "db";

            Console.WriteLine(Object.ReferenceEquals(title2, title1));
        }
예제 #2
0
        static void Main(string[] args)
        {
            WebsiteFactory f = new WebsiteFactory();

            Website fx = f.GetWebsiteCategory("产品展示");

            fx.Use(new User("娇娇"));

            Website fy = f.GetWebsiteCategory("产品展示");

            fy.Use(new User("小菜"));

            Website fz = f.GetWebsiteCategory("博客");

            fz.Use(new User("大鸟"));

            Website fl = f.GetWebsiteCategory("博客");

            fl.Use(new User("老头"));

            Console.WriteLine("总网站数:" + f.GetCount());

            Console.ReadLine();
        }