The override function means "Different methods with the same name with the same arguments." Here I add a little code to override.
Here I use the "Virtual" keyword for the base class. If we want to call a derived class, then we must use the keyword "Override".
To call the base class:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Function_Overriding { public class Program { public virtual void display() { Console.WriteLine("This is Function Overriding"); } public virtual void rnreddy() { Console.WriteLine("This is Possible because of RN Reddy"); } static void Main(string[] args) { Program dc = new Program(); dc.display(); dc.rnreddy(); Console.ReadLine(); } } }
Derived class call
class TestOverride { public class Employee { public string name;
Arjun source share