CSharp examples for Custom Type:Method
Method Hiding with new modifier
using System;/*from www . j a v a2s. c om*/ class Car { public virtual void MoveForward() { Console.WriteLine("Move Car forward by 1 kilometer"); } public void Reverse() { Console.WriteLine("Reverse Car by 50 meters"); } } class FamilyCar : Car { public override void MoveForward() { Console.WriteLine("Move Family Car forward by 5 kilometers"); } public new void Reverse() { Console.WriteLine("Reverse the Family Car by 200 meters"); } } class Tester { public static void Main() { Car myCar; myCar = new FamilyCar(); myCar.MoveForward(); myCar.Reverse(); } }