Chapter 21. Virtual Functions

FAQ 21.01 What is the purpose of this chapter?

image

This chapter describes the syntax and semantics of virtual functions, which are the way C++ does dynamic binding. Part II discusses dynamic binding and should be read before this chapter. Dynamic binding is an important concept, and most member functions should be virtual unless there is some compelling performance reason not to make them virtual or unless the programmer intentionally makes the member function a leaf (also known as final) member function (see FAQ 33.10).

FAQ 21.02 What is a virtual member function?

A virtual member function is a member function preceded ...

Get C++ FAQs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.