English Reference

Word

virtual method

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.

Examples

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

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

“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.”

Examples

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.”

Usage

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

Etymology

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.

Domain

Programming

This entry

Level
C2 · Proficiency
Updated

Scan code

English Reference