private void GrowHair(object item) { IHairy emotional = item as IHairy; if (emotional != null) { Console.Write($"{item.GetType().Name}: "); emotional.GrowHair(); } }
private void GrowHair(object obj) { IHairy hairy = obj as IHairy; if (hairy != null) { Console.WriteLine("{0}", obj.GetType().Name); hairy.GrowHair(); } }