public static void ShowCat(IHomeCat homeCat) { Console.WriteLine("Cat Preview:"); Console.WriteLine($"My name is: {homeCat.Name}"); homeCat.Moou(); homeCat.Sсratch(); }
public static void ShowCatInfo(IHomeCat cat) { Console.WriteLine(cat.Name); cat.Meow(); cat.Scratch(); Console.WriteLine(); }
public static void PrintCatInfo(IHomeCat cat) { Debug.Log("кот: " + cat.Name); Debug.Log("мяуконие: "); cat.Meow(); Debug.Log("царапание: "); cat.Scratch(); }
public static void PrintCatInfo(IHomeCat cat) { Console.WriteLine("Кошачье досье:"); Console.WriteLine(string.Format("Имя кота: {0}", cat.Name)); Console.Write("Вид мяуканья: "); cat.Meow(); Console.Write("Вид царапанья: "); cat.Scratch(); Console.WriteLine(); }
public static void PrintCatInfo(IHomeCat cat) { Console.WriteLine("Cat info:"); Console.WriteLine(string.Format("Cat Name: {0}", cat.Name)); Console.WriteLine("Type of myuay"); cat.Meow(); Console.WriteLine("Typr of Scratching"); cat.Scratch(); Console.WriteLine(); }
public static void PrintCatInfo(IHomeCat cat) { Console.WriteLine("Cats information: "); Console.WriteLine("Cat name: {0}", cat.Name); Console.WriteLine("Meow type: "); cat.Meow(); Console.WriteLine("Scratch type: "); cat.Scratch(); Console.WriteLine(); }
void Start() { vaska = new YardCat(); vaska.Name = "Васька"; wagner = new PedigreedCat(); wagner.Name = "Вагнер"; CatInfoPrinter.PrintCatInfo(vaska); CatInfoPrinter.PrintCatInfo(wagner); //если таким же образом сделать тигра, у которого другой интерфейс //поэтому будет ошибка IWildCat tiger = new Tiger(); // CatInfoPrinter.PrintCatInfo(tiger); //после создания HomeCatAdapter создаём HomeCatAdapter adapter = new HomeCatAdapter(tiger); CatInfoPrinter.PrintCatInfo(adapter); }