I have the following classes:
namespace ConsoleApplication8
{
public abstract class Employee
{
public virtual void Show()
{
Console.WriteLine("from base.");
}
}
public class Manager:Employee
{
public void Show()
{
Console.WriteLine("from child.");
}
}
class Program
{
static void Main(string[] args)
{
var man=new Manager();
man.Show();
Console.ReadKey();
}
}
}
Here I haven't use any override
keyword for the method Show()
in the derived class Manager
but the code is running ok. So what is the actual use of override
keyword.