Skip to content

Commit b5ef532

Browse files
authored
Merge pull request #5285 from Rageking8/refresh-inheritance-cpp
Refresh "Inheritance (C++)"
2 parents 853c2d3 + f50becb commit b5ef532

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

docs/cpp/inheritance-cpp.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,54 @@
11
---
2-
description: "Learn more about: Inheritance (C++)"
3-
title: "Inheritance (C++)"
2+
title: "Inheritance (C++)"
3+
description: "Learn more about: Inheritance (C++)"
44
ms.date: "11/04/2016"
55
helpviewer_keywords: ["derived classes [C++]", "derived classes [C++], about derived classes", "classes [C++], derived"]
6-
ms.assetid: 3534ca19-d9ed-4a40-be1b-b921ad0e6956
76
---
8-
# Inheritance (C++)
7+
# Inheritance (C++)
98

109
This section explains how to use derived classes to produce extensible programs.
1110

1211
## Overview
1312

14-
New classes can be derived from existing classes using a mechanism called "inheritance" (see the information beginning in [Single Inheritance](../cpp/single-inheritance.md)). Classes that are used for derivation are called "base classes" of a particular derived class. A derived class is declared using the following syntax:
13+
New classes can be derived from existing classes using a mechanism called "inheritance" (see the information beginning in [Single Inheritance](single-inheritance.md)). Classes that are used for derivation are called "base classes" of a particular derived class. A derived class is declared using the following syntax:
1514

1615
```cpp
17-
class Derived : [virtual] [access-specifier] Base
16+
class DerivedSingleBase : [virtual] [access-specifier] Base
1817
{
19-
// member list
18+
// member list
2019
};
21-
class Derived : [virtual] [access-specifier] Base1,
22-
[virtual] [access-specifier] Base2, . . .
20+
21+
class DerivedMultipleBases : [virtual] [access-specifier] Base1,
22+
[virtual] [access-specifier] Base2, ...
2323
{
24-
// member list
24+
// member list
2525
};
2626
```
2727

28-
After the tag (name) for the class, a colon appears followed by a list of base specifications. The base classes so named must have been declared previously. The base specifications may contain an access specifier, which is one of the keywords **`public`**, **`protected`** or **`private`**. These access specifiers appear before the base class name and apply only to that base class. These specifiers control the derived class's permission to use to members of the base class. See [Member-Access Control](../cpp/member-access-control-cpp.md) for information on access to base class members. If the access specifier is omitted, the access to that base is considered **`private`**. The base specifications may contain the keyword **`virtual`** to indicate virtual inheritance. This keyword may appear before or after the access specifier, if any. If virtual inheritance is used, the base class is referred to as a virtual base class.
28+
After the tag (name) for the class, a colon appears followed by a list of base specifications. The base classes so named must have been declared previously. The base specifications may contain an access specifier, which is one of the keywords [**`public`**](public-cpp.md), [**`protected`**](protected-cpp.md) or [**`private`**](private-cpp.md). These access specifiers appear before the base class name and apply only to that base class. These specifiers control the derived class's permission to use members of the base class. See [Member-Access Control](member-access-control-cpp.md) for information on access to base class members. If the access specifier is omitted, the access to that base is considered **`private`**. The base specifications may contain the keyword [**`virtual`**](virtual-cpp.md) to indicate virtual inheritance. This keyword may appear before or after the access specifier, if any. If virtual inheritance is used, the base class is referred to as a virtual base class.
2929

30-
Multiple base classes can be specified, separated by commas. If a single base class is specified, the inheritance model is [Single inheritance](../cpp/single-inheritance.md). If more than one base class is specified, the inheritance model is called [Multiple inheritance](../cpp/multiple-base-classes.md).
30+
Multiple base classes can be specified, separated by commas. If a single base class is specified, the inheritance model is [Single inheritance](single-inheritance.md). If more than one base class is specified, the inheritance model is called [Multiple inheritance](multiple-base-classes.md).
3131

3232
The following topics are included:
3333

34-
- [Single inheritance](../cpp/single-inheritance.md)
34+
- [Single inheritance](single-inheritance.md)
35+
36+
- [Multiple base classes](multiple-base-classes.md)
37+
38+
- [Virtual functions](virtual-functions.md)
3539

36-
- [Multiple base classes](../cpp/multiple-base-classes.md)
40+
- [Explicit overrides](explicit-overrides-cpp.md)
3741

38-
- [Virtual functions](../cpp/virtual-functions.md)
42+
- [Abstract classes](abstract-classes-cpp.md)
3943

40-
- [Explicit overrides](../cpp/explicit-overrides-cpp.md)
44+
- [Summary of scope rules](summary-of-scope-rules.md)
4145

42-
- [Abstract classes](../cpp/abstract-classes-cpp.md)
46+
**Microsoft Specific**
4347

44-
- [Summary of scope rules](../cpp/summary-of-scope-rules.md)
48+
The [`__super`](super.md) and [`__interface`](interface.md) keywords are documented in this section.
4549

46-
The [__super](../cpp/super.md) and [__interface](../cpp/interface.md) keywords are documented in this section.
50+
**END Microsoft Specific**
4751

4852
## See also
4953

50-
[C++ Language Reference](../cpp/cpp-language-reference.md)
54+
[C++ Language Reference](cpp-language-reference.md)

0 commit comments

Comments
 (0)