Polymorphism
problem: The program you are given declares Unit class which has a method Attack(). It outputs "Using sword!". Derive Musketeer and Magician classes from the Unit class and override its Attack() method to output the corresponding messages while attacking: Musketeer => "Using musket!" Magician =>"Using magic!" Question: What I'm i doing wrong? My solution: namespace polymoprhism { class Program { static void Main(string[] args) { Unit unit1 = new Unit(); Unit musketeer = new Musketeer(); Unit magician = new Magician(); unit1.Attack(); musketeer.Attack(); magician.Attack(); Console.ReadKey(); } } class Unit { public virtual void Attack() { Console.WriteLine("Using sword!"); } } /*derive the class from Unit class and override Attack() method*/ class Musketeer : Unit { public override void Attack() { Console.WriteLine("Musketeer => Using musket!"); } } /*derive the class from Unit class and override Attack() method*/ class Magician : Unit { public override void Attack() { Console.WriteLine("Magician => Using magic!"); } } }