January 2011
Intermediate to advanced
1648 pages
70h 30m
English
Methods, properties, indexers, and events can be declared as virtual members using the virtual keyword used as a modifier on the member declaration. Virtual members can be overridden in a derived class to specialize their behavior. The simplest example can be found on the System.Object type itself, which is roughly defined as follows (omitting a bunch of irrelevant custom attributes and members):

Notice how three methods have been declared as virtual by the .NET Framework team. Although those methods have default implementations, a common developer task is to override them with specialized behavior to account for the specific semantics ...
Read now
Unlock full access