Skip to content

Latest commit

 

History

History
47 lines (44 loc) · 1.57 KB

File metadata and controls

47 lines (44 loc) · 1.57 KB
title Base Classes | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-language
ms.tgt_pltfrm
ms.topic language-reference
dev_langs
C++
helpviewer_keywords
inheritance, multiple
base classes, virtual
derived classes, multiple bases
multiple inheritance, base classes
virtual base classes
base classes
ms.assetid 6e6d54d0-6f21-4a16-9103-22935d98f596
caps.latest.revision 7
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Base Classes

The inheritance process creates a new derived class that is made up of the members of the base class(es) plus any new members added by the derived class. In a multiple-inheritance, it is possible to construct an inheritance graph where the same base class is part of more than one of the derived classes. The following figure shows such a graph.

Multiple instances of a base class
Multiple Instances of a Single Base Class

In the figure, pictorial representations of the components of CollectibleString and CollectibleSortable are shown. However, the base class, Collectible, is in CollectibleSortableString through the CollectibleString path and the CollectibleSortable path. To eliminate this redundancy, such classes can be declared as virtual base classes when they are inherited.