NewVsOveride

10/02/2009 1:37 PM

New Vs. Override

New

base:: public void print() { print 'a'; }
public void callPrint() { print(); } child:: public new void print() { print 'b'; }

examples

base.print():: a child.print():: b ((base)child).print():: a base.callPrint():: a child.callPrint():: a

Override

base:: public virtual void print() { print 'a'; }
public void callPrint() { print(); } child:: public override void print() { print 'b'; }

examples

base.print():: a child.print():: b ((base)child).print():: b base.callPrint():: a child.callPrint():: b

Tags:
Home: WikiStart
What's new: Recently changed articles
You can subscribe to this wiki article using an RSS feed reader.