コード例 #1
0
        public void MakeBaby(Dad dad, string name)
        {
            Baby baby = new Baby(name);

            Child     = baby;
            dad.Child = baby;
            baby.AddComforter(dad.ComfortChild);
            baby.AddComforter(ComfortChild);
            Console.WriteLine($"{Name} ha fatto un figlio con {dad.Name}, che si chiama {baby.Name}");
        }
コード例 #2
0
        public override void Run(IGUI guiHandler)
        {
            Mum   leila   = new Mum("Leila");
            Dad   hanSolo = new Dad("Han Solo");
            Robot r2d2    = new Robot("R2D2");
            Baby  benSolo = leila.MakeBaby(hanSolo, "Ben Solo");

            //benSolo.AddComforter(r2d2.Comfort);

            benSolo.StartCrying();
            benSolo.StartCrying();
            benSolo.StartCrying();
            benSolo.StartCrying();
            benSolo.StartCrying();

            benSolo.AddComforter(TheForce.ComfortChild);
            benSolo.StartCrying();


            Console.ReadKey();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Robot r2d2 = new Robot("R2D2");

            Mum leila   = new Mum("Leila");
            Dad hanSolo = new Dad("Han Solo");

            leila.MakeBaby(hanSolo, "Kylo Ren");

            leila.Child.AddComforter(r2d2.Comfort);

            leila.Child.AddComforter(TheForce.ComfortChild);

            leila.Child.StartCrying();
            leila.Child.StartCrying();
            leila.Child.StartCrying();
            leila.Child.StartCrying();
            leila.Child.StartCrying();

            Console.Read();
        }
コード例 #4
0
 public void Comfort(Dad dad)
 {
     Console.WriteLine($"{Name} dà una pacca sulla spalla a {dad.Name}");
 }