Example #1
0
        static void Main(string[] args)
        {
            // questa sarebbe la sintassi con i getter e setter invece delle proprietà:
            //b.SetName("Pippo");
            //Console.WriteLine(b.GetName());

            // le Proprietà, rispetto ai getter e setter, mi permettono anche
            // operazioni di post/pre-increment, ecc.
            //obj.IntValue++;
            //obj.SetIntValue(obj.GetIntValue() + 1);

            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);

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

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            Mum leila   = new Mum("Leila");
            Dad hanSolo = new Dad("Han Solo");

            leila.MakeBaby(hanSolo, "Kilo-Ren");



            Console.ReadLine();
        }
Example #3
0
 public void MakeBaby(Mum mum, string childName)
 {
     Baby b = new Baby(childName);
 }