示例#1
0
        static void Main(string[] args)
        {
            // HR New Employee Process

            IDeviceFactory factory = new SamsungFactory();

            IMobilePhone phone = factory.CreateMobilePhone();

            phone.Call("+45 12345678");

            ITablet tablet = factory.CreateTablet();

            tablet.PowerOn();
            tablet.PowerOff();
        }
示例#2
0
        static void Main(string[] args)
        {
            // HR New Employee Process

            IDeviceFactory factory = new AppleFactory(); // <-- Only(!) reference to vendor

            IMobilePhone phone = factory.CreateMobilePhone();

            phone.Call("+45 12345678");

            ITablet tablet = factory.CreateTablet();

            tablet.PowerOn();
            tablet.PowerOff();
        }