Content deleted Content added
→Behavior during construction and destruction: Elaboration. |
|||
Line 15:
Virtual functions allow a program to call methods that don't necessarily even exist at the moment the code is compiled.
In C++, ''virtual methods'' are declared by prepending the {{Cpp|virtual}} keyword to the function's declaration in the base class. This modifier is inherited by all implementations of that method in derived classes, meaning that they can continue to over-ride each other and be late-bound. And even if methods owned by the base class call the virtual method, they will instead be calling the derived method.
== Example ==
|