static void Main() { cat cat = new cat(); whale whale = new whale(); dog dog = new dog(); cat.getNaim(); whale.getNaim(); object Child = new object(); bool f = true; while (true && f) { Console.WriteLine("кто радит (1-кошка,2-собака,0-проверять дальше)"); switch (Console.ReadKey().KeyChar) { case '1': Child = cat.getChild(); break; case '2': Child = dog.getChild(); break; case '0': f = false; break; } } Child = cat.getChild(); Console.ReadKey(); }
public override Object getChild() { dog Child = new dog(); return(Child); }