From Jason Turner

[class.access.base]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpd1grp_rn/{from.md → to.md} +19 -18
tmp/tmpd1grp_rn/{from.md → to.md} RENAMED
@@ -1,18 +1,18 @@
1
- ## Accessibility of base classes and base class members <a id="class.access.base">[[class.access.base]]</a>
2
 
3
- If a class is declared to be a base class (Clause  [[class.derived]])
4
- for another class using the `public` access specifier, the `public`
5
- members of the base class are accessible as `public` members of the
6
- derived class and `protected` members of the base class are accessible
7
- as `protected` members of the derived class. If a class is declared to
8
- be a base class for another class using the `protected` access
9
- specifier, the `public` and `protected` members of the base class are
10
- accessible as `protected` members of the derived class. If a class is
11
- declared to be a base class for another class using the `private` access
12
- specifier, the `public` and `protected` members of the base class are
13
- accessible as `private` members of the derived class[^8].
14
 
15
  In the absence of an *access-specifier* for a base class, `public` is
16
  assumed when the derived class is defined with the *class-key* `struct`
17
  and `private` is assumed when the class is defined with the *class-key*
18
  `class`.
@@ -38,14 +38,15 @@ Here `B` is a public base of `D2`, `D4`, and `D6`, a private base of
38
 
39
  [*Note 1*:
40
 
41
  A member of a private base class might be inaccessible as an inherited
42
  member name, but accessible directly. Because of the rules on pointer
43
- conversions ([[conv.ptr]]) and explicit casts ([[expr.cast]]), a
44
- conversion from a pointer to a derived class to a pointer to an
45
- inaccessible base class might be ill-formed if an implicit conversion is
46
- used, but well-formed if an explicit cast is used. For example,
 
47
 
48
  ``` cpp
49
  class B {
50
  public:
51
  int mi; // non-static member
@@ -117,12 +118,12 @@ immediate base class of `X`. — *end note*]
117
  The access to a member is affected by the class in which the member is
118
  named. This naming class is the class in which the member name was
119
  looked up and found.
120
 
121
  [*Note 3*: This class can be explicit, e.g., when a *qualified-id* is
122
- used, or implicit, e.g., when a class member access operator (
123
- [[expr.ref]]) is used (including cases where an implicit “`this->`” is
124
  added). If both a class member access operator and a *qualified-id* are
125
  used to name the member (as in `p->T::m`), the class naming the member
126
  is the class denoted by the *nested-name-specifier* of the
127
  *qualified-id* (that is, `T`). — *end note*]
128
 
 
1
+ ### Accessibility of base classes and base class members <a id="class.access.base">[[class.access.base]]</a>
2
 
3
+ If a class is declared to be a base class [[class.derived]] for another
4
+ class using the `public` access specifier, the public members of the
5
+ base class are accessible as public members of the derived class and
6
+ protected members of the base class are accessible as protected members
7
+ of the derived class. If a class is declared to be a base class for
8
+ another class using the `protected` access specifier, the public and
9
+ protected members of the base class are accessible as protected members
10
+ of the derived class. If a class is declared to be a base class for
11
+ another class using the `private` access specifier, the public and
12
+ protected members of the base class are accessible as private members of
13
+ the derived class.[^12]
14
 
15
  In the absence of an *access-specifier* for a base class, `public` is
16
  assumed when the derived class is defined with the *class-key* `struct`
17
  and `private` is assumed when the class is defined with the *class-key*
18
  `class`.
 
38
 
39
  [*Note 1*:
40
 
41
  A member of a private base class might be inaccessible as an inherited
42
  member name, but accessible directly. Because of the rules on pointer
43
+ conversions [[conv.ptr]] and explicit casts ([[expr.type.conv]],
44
+ [[expr.static.cast]], [[expr.cast]]), a conversion from a pointer to a
45
+ derived class to a pointer to an inaccessible base class might be
46
+ ill-formed if an implicit conversion is used, but well-formed if an
47
+ explicit cast is used. For example,
48
 
49
  ``` cpp
50
  class B {
51
  public:
52
  int mi; // non-static member
 
118
  The access to a member is affected by the class in which the member is
119
  named. This naming class is the class in which the member name was
120
  looked up and found.
121
 
122
  [*Note 3*: This class can be explicit, e.g., when a *qualified-id* is
123
+ used, or implicit, e.g., when a class member access operator
124
+ [[expr.ref]] is used (including cases where an implicit “`this->`” is
125
  added). If both a class member access operator and a *qualified-id* are
126
  used to name the member (as in `p->T::m`), the class naming the member
127
  is the class denoted by the *nested-name-specifier* of the
128
  *qualified-id* (that is, `T`). — *end note*]
129