liveBook · Manning

Virtual method

A virtual method is an overridable method whose implementation is selected at runtime according to the receiver object's dynamic type.

How 3 Manning books explain it

Learn C++ by Example

A virtual function is a C++ member function whose implementation can be selected according to the object's dynamic type through polymorphic dispatch.

How it is used
Uses virtual methods to let different blob types compete through one common race interface.
How deep it goes
Explains pure virtual methods, overriding, v-table dispatch, destructor safety, and pointer-based use without detailing compiler-generated layouts.
Examples
Demonstrates StepperBlob, RandomBlob, a Blob race, assertions, random distributions, and a zero-valued test generator.
What you can do after
Build it from scratch by defining a polymorphic Blob interface and implementing interchangeable derived classes with tested behavior.

Read how Learn C++ by Example explains virtual method →

100 C++ Mistakes and How to Avoid Them

A virtual function is a C++ member function whose implementation can be dynamically selected through an object of a derived class.

How it is used
Uses virtual methods to customize inherited behavior and preserve polymorphic operations across base-class interfaces.
How deep it goes
Explains dispatch through pointers or references, override checking, and destructor consequences, but does not detail dispatch internals.
Examples
Demonstrates Shape, Square, and Circle examples containing a misspelled override and a missing virtual destructor.
What you can do after
Apply polymorphism with compiler-checked overrides and destruct safely through base-class pointers.

Read how 100 C++ Mistakes and How to Avoid Them explains virtual method →

The Quick Python Book, Fourth Edition

A virtual method is a method whose implementation can be dynamically selected according to the class of the object on which it is invoked.

How it is used
Uses superclass lookup to share methods across related Python classes while permitting subclass-specific replacements.
How deep it goes
Defines dynamic method lookup and inheritance, but stops short of implementation-level dispatch details.
Examples
Demonstrates inherited movement through Shape, Circle, coordinates, and a concrete c.move(3, 4) call.
What you can do after
Evaluate inherited method behavior by tracing subclass and superclass lookup in small Python class hierarchies.

Read how The Quick Python Book, Fourth Edition explains virtual method →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.