Difference between new and override

Wondering what the difference is between the following:

Case 1: Base Class

public void DoIt();

Case 1: Inherited class

public new void DoIt();

Case 2: Base Class

public virtual void DoIt();

Case 2: Inherited class

public override void DoIt();

Both case 1 and 2 appear to have the same effect based on the tests I have run. Is there a difference, or a preferred way?

14 Answers
14

Leave a Comment