Showing posts with label Method overriding. Show all posts
Showing posts with label Method overriding. Show all posts

Thursday, June 28, 2012

Virtual Keyword In C#

Virtual Keyword in C#




  • When a derived class want to override  the base class member(s) then base class member(s)  need to marked as virtual members.

  • A function marked as virtual can be overridden by subclasses wishing to provide a specialized implementation.

  • Methods, properties, indexers, and events can all be declared as virtual.

  • In the derived class those members will be marked by override  keyword.