Search code examples
c++virtual

Why are virtual functions in C++ called 'virtual'?


So I am new to the concept of virtual functions in C++, and threads like this do a good job of selling this concept. Ok I am convinced.

But why are virtual functions called 'virtual'? I mean such functions are as 'concrete' as usual functions / methods aren't they? If someone could explain the choice of the word 'virtual' for naming this concept, that would be great.


Solution

  • Virtuality, the quality of having the attributes of something without sharing its (real or imagined) physical form

    ^ http://en.wikipedia.org/wiki/Virtual

    A C++ virtual function appears to be an ordinary function ("having the attributes of"), but the implementation that will be called is not shared out via the declaration, or for that matter via an inline implementation.