static void Main(string[] args) { Lion lion = new Lion(); Tiger tiger = new Tiger(); tiger.SetMe("tiger", 100); lion.SetMe("lion", 200); tiger.Show(); lion.Show(); }
static void Main(string[] agrs) { Lion objLion = new Lion(); objLion.SetMe("Lion", 100); objLion.Show(); Tiger obgTiger = new Tiger(); obgTiger.SetMe("Tiger", 200); obgTiger.Show(); }
static void Main() { lion lion1 = new lion(); lion1.SetMe(200, "Lion"); lion1.Show(); Tiger Tiger1 = new Tiger(); Tiger1.SetMe(100, "tiger"); Tiger1.Show(); }
public void AddAnimal() { Console.WriteLine("1. Add new Tiger: "); Console.WriteLine("2. Add new Cat: "); Console.WriteLine("3. Add new Dog: "); int select = Convert.ToInt32(Console.ReadLine()); switch (select) { case 1: Console.Write("Creat name Tiger: "); string name = Console.ReadLine(); Console.Write("Age Tiger: "); int old = Convert.ToInt32(Console.ReadLine()); Console.Write("Description Tiger: "); string description = Console.ReadLine(); Tiger tiger = new Tiger(name, old, description); AnimalList.Add(tiger); break; case 2: Console.Write("Creat name Cat: "); string nameCat = Console.ReadLine(); Console.Write("Age Cat: "); int oldCat = Convert.ToInt32(Console.ReadLine()); Console.Write("Description Cat: "); string descriptionCat = Console.ReadLine(); Cat cat = new Cat(nameCat, oldCat, descriptionCat); AnimalList.Add(cat); break; case 3: Console.Write("Creat name Dog: "); string nameDog = Console.ReadLine(); Console.Write("Age Dog: "); int oldDog = Convert.ToInt32(Console.ReadLine()); Console.Write("Description Dog: "); string descriptionDog = Console.ReadLine(); Cat dog = new Cat(nameDog, oldDog, descriptionDog); AnimalList.Add(dog); break; } }