C# Object Initialization
using System;
namespace Application
{
public class Program
{
static void Main(string[] args)
{
BaseClass derivedObj = new DerivedClass();
derivedObj.ChangeGrade();
}
}
/// <summary>
/// Delcare a public parent class
/// </summary>
public class BaseClass
{
public BaseClass()
{
Console.WriteLine();
}
static BaseClass()
{
Console.WriteLine();
}
public virtual void ChangeGrade()
{
}
}
/// <summary>
/// Declare a public child class
/// </summary>
public class DerivedClass : BaseClass
{
public DerivedClass()
{
Console.WriteLine();
}
static DerivedClass()
{
Console.WriteLine();
}
public override void ChangeGrade()
{
base.ChangeGrade();
}
}
}