Exemplo n.º 1
0
 public MiniFigure(string name, Head head, Torso torso, Legs.Legs legs)
 {
     Name   = name;
     _head  = head;
     _torso = torso;
     _legs  = legs;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var head        = new NathanHead();
            var reptileBody = new ReptilianTorso();

            ;            reptileBody.Color = "Brown";
            var babyLegs = new BabyLegs();

            babyLegs.Length    = 19;
            babyLegs.MainColor = "purple";
            babyLegs.ShoeColor = "yellow";

            var bestTeacher = new MiniFigure("Nathan", head, reptileBody, babyLegs);

            bestTeacher.Greet(new Person {
                Name = "Bob"
            });

            var head2    = new MartinHead();
            var birdBody = new BirdTorso();

            ; reptileBody.Color = "pink";
            var manLegs = new Legs.Legs();

            manLegs.Length    = 10;
            manLegs.MainColor = "blue";
            manLegs.ShoeColor = "brown";

            var martin = new MiniFigure("Steve", head2, birdBody, manLegs);

            martin.Greet(bestTeacher);

            bestTeacher.Karate(martin);

            bestTeacher.TakeABreak();
            martin.TakeABreak();

            var pastor = new Pastor();

            var greeters = new List <IGreeter> {
                pastor, bestTeacher, martin
            };

            foreach (var greeter in greeters)
            {
                greeter.Greet(pastor);
            }

            Console.ReadLine();
        }