- A C++ technique that ensures only one copy of a base class’s member variables are inherited by grandchild-derived classes. Without virtual inheritance, if two classes
BandCinherit from a classA, and a classDinherits from bothBandC, thenDwill contain two copies ofA’s member variables: one viaB, and one viaC. These will be accessible independently, using scope resolution. Instead, if classesBandCinherit virtually from classA, then objects of classDwill contain only one set of the member variables from classA. This feature is most useful for multiple inheritance, as it makes the virtual base a common subobject for the deriving class and all classes that are derived from it. ← Wikipedia
This term is sponsored by: your name/company?
- Previous term: Virtual dedicated server
- Next term: Virtual LAN
- Random term: Programming language (webglossary.info/random 🎲)