Exemple #1
0
        private static void Main(string[] args)
        {
            Manufacturer manufacturer = new Manufacturer();

            IPhoneBuilder phoneBuilder = null;

            phoneBuilder = new AndroidPhoneBuilder();
            manufacturer.Construct(phoneBuilder);
            Console.WriteLine("A new Phone built:\n\n{0}", phoneBuilder.Phone.ToString());

            phoneBuilder = new WindowsPhoneBuilder();
            manufacturer.Construct(phoneBuilder);
            Console.WriteLine("A new Phone built:\n\n{0}", phoneBuilder.Phone.ToString());
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Manufacturer newManufacturer = new Manufacturer();
            // LETS HAVE THE BUILDER CLASS READY
            IPhoneBuilder phoneBuilder = null;

            // NOW LET US CREATE AN ANDROID PHONE
            phoneBuilder = new AndroidPhoneBuilder();
            newManufacturer.ConstructInSequence(phoneBuilder);
            Console.WriteLine(phoneBuilder.Phone);

            Console.WriteLine();
            // NOW LET US CREATE A WINDOWS PHONE
            phoneBuilder = new WindowsPhoneBuilder();
            newManufacturer.ConstructInSequence(phoneBuilder);
            Console.WriteLine(phoneBuilder.Phone);

            Console.ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            // Lets create the Director first
            Manufacturer newManufacturer = new Manufacturer();
            // Lets have the Builder class ready
            IBuilderPhone phoneBuilder = null;

            // Now let us create an android phone
            phoneBuilder = new AndroidPhoneBuilder();
            newManufacturer.Construct(phoneBuilder);
            Console.WriteLine("A new Phone built:\n\n{0}", phoneBuilder.Phone.ToString());


            Console.WriteLine("\n\n");


            // Now let us create a Windows Phone
            phoneBuilder = new WindowsPhoneBuilder();
            newManufacturer.Construct(phoneBuilder);
            Console.WriteLine("A new Phone built:\n\n{0}", phoneBuilder.Phone.ToString());

            Console.ReadKey();
        }