static void Main(string[] args) { Person human1 = new Person("William", "Bobby"); Person human2 = new Person("Elizabeth", "Liz"); Superhero hero1 = new Superhero("super person", " ", "Tony", "flying"); Superhero hero2 = new Superhero("awesome person", " ", "Jessica", "Invisibility"); Villian evil1 = new Villian("Doctor Evil", " ", "Austin Powers"); Villian evil2 = new Villian("The Joker", " ", "Batman"); List <Person> HumanList = new List <Person>(); HumanList.Add(human1); HumanList.Add(human2); HumanList.Add(hero1); HumanList.Add(hero2); HumanList.Add(evil1); HumanList.Add(evil2); foreach (Person i in HumanList) { i.PrintGreeting(); } Console.ReadKey(); }
static void Main(string[] args) { Person Steve = new Person("Steve", "Killer"); people.Add(Steve); SuperHero Wolverine = new SuperHero("Logan", "adamantium claws", "Wolverine", "nickname"); people.Add(Wolverine); Villian Bane = new Villian("Batman", "Bane", "nickname"); people.Add(Bane); foreach (var item in people) { Console.WriteLine(item.ToString() + ": " + item.printGreeting()); } Console.Read(); }
static void Main(string[] args) { Person human1 = new Person("William", "Bobby"); Person human2 = new Person("Elizabeth", "Liz"); Superhero hero1 = new Superhero("super person", " ", "Jared", "super strength"); Superhero hero2 = new Superhero("awesome person", " ", "Erin", "invisibility"); Villian evil1 = new Villian("Bowser", " ", "Super Mario"); Villian evil2 = new Villian("The Joker", " ", "Batman"); List <Person> HumanList = new List <Person>(); HumanList.Add(human1); HumanList.Add(human2); HumanList.Add(hero1); HumanList.Add(hero2); HumanList.Add(evil1); HumanList.Add(evil2); foreach (Person i in HumanList) { i.PrintGreeting(); } Console.ReadKey(); }