Exemple #1
0
            static void Main(string[] args)
            {
                //create a constructor object to start building
                Kid aKid = new Kid();
                aKid.Name = "Elizabeth";

                //Elizabeth use Monkey moid to make a monkey
                Console.WriteLine("{0} start making a monkey",aKid.Name);
                AnimalBuilder builderA = new MonkeyBuilder();
                aKid.MakeAnimal(builderA);
                builderA.aAnimal.ShowMe();

                //Elizabeth use Kitten moid to make a kitten
                 Console.WriteLine("{0} start making a kitten",aKid.Name);
                 AnimalBuilder builderB = new KittenBuilder();
                 aKid.MakeAnimal(builderB);
                 builderB.aAnimal.ShowMe();

                Console.Read();
            }
Exemple #2
0
        static void Main(string[] args)
        {
            AnimalBuilder animalBuilder;
            Kid           kid = new Kid
            {
                Name = "Elizabeth"
            };

            Console.WriteLine("{0} start making a monkey", kid.Name);
            animalBuilder = new MonkeyBuilder();
            kid.MakeAnimal(animalBuilder);
            animalBuilder.animal.ShowMe();

            Console.WriteLine();

            Console.WriteLine("{0} start making a kitten", kid.Name);
            animalBuilder = new KittenBuilder();
            kid.MakeAnimal(animalBuilder);
            animalBuilder.animal.ShowMe();

            Console.ReadKey();
        }