public void MakeBaby(Dad dad, string name) { Baby baby = new Baby(name); Child = baby; dad.Child = baby; baby.AddComforter(dad); baby.AddComforter(this); Console.WriteLine($"{Name} has had a baby with {dad.Name}, his name is {baby.Name}"); }
static void Main(string[] args) { Robot r2d2 = new Robot("R2D2"); Mum leia = new Mum("Leia"); Dad hanSolo = new Dad("Han Solo"); leia.MakeBaby(hanSolo, "Ben Solo"); leia.Child.AddComforter(r2d2); leia.Child.StartCrying(); leia.Child.StartCrying(); leia.Child.StartCrying(); leia.Child.StartCrying(); leia.Child.StartCrying(); Console.Read(); }