Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 1
    Got it...Jason's answer really cracked it open for me! Thanks guys ;) Commented Jan 14, 2010 at 18:54
  • @EricLippert Great explanation. just have one confusion, When you say "new C()", BOX1 is filled in with MA and BOX2 is filled in with MC. So BOX2 (box of class B) is filled with MC , but if we do class C : B { public override void mVVirtual() { base.mVVirtual(); Console.WriteLine("C::mVVirtual"); } } it will print B::mVVirtual C::mVVirtual but I thought Box2 is filled with MC. Commented Jul 11, 2017 at 4:57
  • 2
    @Posto: "base" calls are non-virtual calls. The compiler generates a call directly to the base class method, rather than doing an indirect call by looking up the contents of the virtual method slot. Commented Jul 11, 2017 at 14:21
  • Okay, can you point to any resources (online docs etc) where I can get details understanding for non-virtual or virtual calls Commented Jul 11, 2017 at 14:27
  • @Posto: ericlippert.com/2011/03/17/… Commented Jul 11, 2017 at 14:38