using System;
namespace Chapter762_Case1_UserOverrideToPrint
{
class Program
{
class MyBaseClass
{
virtual public void Print()
{
Console.WriteLine("This is the base class. with virtual");
}
}
class MyDerivedClass : MyBaseClass
{
override public void Print()
{
Console.WriteLine("This is the derived class. with override");
}
}
class SecondDerivedClass : MyDerivedClass
{
override public void Print()
{
Console.WriteLine("This is the SecondDerived class. with override");
}
}
static void Main(string[] args)
{
//Console.WriteLine("Hello World!");
SecondDerivedClass secderived = new SecondDerivedClass();
MyBaseClass mybc = (MyBaseClass)secderived;
secderived.Print();
mybc.Print();
}
}
}