OOPS In C# – Inheritance Part 6
Scenario:-
Function declared as virtual in base class and overridden in child class. See the sample code below:
public class MyClass
{
public virtual void foo()
{
Console.WriteLine("Base version of foo");
}
}
public class MyChild : MyClass
{
public override void foo()
{
Console.WriteLine("Child version of foo");
}
}