ENGLISH
REFERENCE

virtual method

compound.
C2 Proficiency Programming
Definition

compound. a function in computer programming that can be changed or replaced by a more specific version in a later part of the code. It allows a program to decide which version of a task to run while it is actually working.

compound. a member function within a base class that is intended to be overridden by derived classes. It facilitates runtime polymorphism by ensuring that the call to the function is resolved based on the actual type of the object rather than the type of the pointer or reference.


SIMPLE

The programmer used a virtual method to handle different types of user input.

CONTEXTUAL

By defining the 'draw' function as a virtual method in the base class, the software can correctly render various shapes at runtime.

COMPLEX

The implementation of a virtual method typically relies on a dispatch table, allowing the execution environment to perform dynamic binding and execute the most specific subclass implementation available.

Origin

A compound of virtual, from the Latin virtualis, and method, from the Greek methodos. The term emerged in the late 1960s within the development of the Simula programming language.

Etymology adapted from Wiktionary, available under CC BY-SA 4.0.

Usage

Commonly used in object-oriented programming languages like C++, C#, and Java.

Related words

Last updated July 22, 2026