Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Virtual function

Virtual function

Virtual function is a feature.

A virtual function defines a target function to be executed, but the target might not be known at compile time.

Languages with Virtual function include C++

Example from C++:
class Animal { public: // Intentionally not virtual: void Move(void) { std::cout << "This animal moves in some way" << std::endl; } virtual void Eat(void) = 0; }; // The class "Animal" may possess a definition for Eat if desired. class Llama : public Animal { public: // The non virtual function Move is inherited but not overridden. void Eat(void) override { std::cout << "Llamas eat grass!" << std::endl; } };
units-of-measure-feature.html 路 virtual-functions-feature.html 路 while-loops-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub