Lecture overview -- Keyboard shortcut: 'u'  Previous page: Is repeated inheritance possible? No! -- Keyboard shortcut: 'p'  Next page: Base class access -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 4 - Page 19 : 24
Notes about C++
Abstraction Mechanisms, Part 2
Shared base class: Virtual base

Per default you get replicated base classes in C++

It is also possible for B and C to to share their A parts in a D-object

  • The C++ Programming Language: Page 396
 

 

To see this image you must download and install the SVG plugin from Adobe.In Firefox please consultthis page.

The base class A is replicated

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/virtual-bases/virtual-1.ccIllustration of shared, virtual, base class A.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/virtual-bases/virtual-1-outputProgram output.


Every base class of a given name that is specified to be virtual will be represented by a single object of that class, §15.2.4