using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InheritenceExample
{
class Program
{
static void Main(string[] args)
{
b obja = new b();
obja.Method1();
Console.ReadLine();
}
}
public class a
{
public virtual void Method1()
{
Console.WriteLine("base class method is called.");
}
}
public class b : a
{
public override void Method1()
{
base.Method1(); // calling base class method.
}
}
}
Result : Base class method is called.