Lesson plan

Virtual function

In object-oriented programming such as is often used in C++ and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method that is dispatched dynamically. Virtual functions are an important part of (runtime) polymorphism in object-oriented programming (OOP). They allow for the execution of target functions that were not precisely identified at compile time. Many programming languages, such as Java, treat all methods as virtual by default. Some of these languages, such as Python, do not allow changing this behavior. However, others may provide modifiers that prevent methods from being overridden by derived classes (such as the final and private keywords in Java and PHP ).

Back to article

Article summary

In object-oriented programming such as is often used in C++ and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method that is dispatched dynamically. Virtual functions are an important part of (runtime) polymorphism in object-oriented programming (OOP). They allow for the execution of target functions that were not precisely identified at compile time. Many programming languages, such as Java, treat all methods as virtual by default. Some of these languages, such as Python, do not allow changing this behavior. However, others may provide modifiers that prevent methods from being overridden by derived classes (such as the final and private keywords in Java and PHP ).

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.