In many object oriented programming languages such as C++, C#, VB.NET, a virtual function is a function that can be overridden with specialized implementations in subclasses.

For example, a Base Class Animal could have a virtual function eat. Subclass Fly would implement eat differently than subclass Wolf, but you can invoke eat on any base class instance.

This allows you to process a list of Animals, telling each in turn to eat, with no knowledge of what kind of animal may be in the list. You also need have no knowledge of how each Animal eats.

See also super class