Calling virtual functions ancestor class in C#

  • Thread starter Alexander Vasilevsky
  • Start date
N

Nicholas Paldino [.NET/C# MVP]

Alexander,

You can only call the implementation in the base, no further up in the
hierarchy. You would use the base keyword, like so:

base.VirtualFunction();

VirtualFunction is the virtual function name to call the base class
implementation of.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You can use base.YourMethod();

note that you can ONLY call the one inmediately above the class, there is
no way to call the "grandparet" method
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top