From Jason Turner

[class.access.spec]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpd7rxs_0u/{from.md → to.md} +23 -7
tmp/tmpd7rxs_0u/{from.md → to.md} RENAMED
@@ -5,22 +5,28 @@ Member declarations can be labeled by an *access-specifier* (Clause 
5
 
6
  An *access-specifier* specifies the access rules for members following
7
  it until the end of the class or until another *access-specifier* is
8
  encountered.
9
 
 
 
10
  ``` cpp
11
  class X {
12
  int a; // X::a is private by default: class used
13
  public:
14
  int b; // X::b is public
15
  int c; // X::c is public
16
  };
17
  ```
18
 
 
 
19
  Any number of access specifiers is allowed and no particular order is
20
  required.
21
 
 
 
22
  ``` cpp
23
  struct S {
24
  int a; // S::a is public by default: struct used
25
  protected:
26
  int b; // S::b is protected
@@ -29,37 +35,47 @@ private:
29
  public:
30
  int d; // S::d is public
31
  };
32
  ```
33
 
34
- The effect of access control on the order of allocation of data members
35
- is described in  [[class.mem]].
 
 
36
 
37
  When a member is redeclared within its class definition, the access
38
  specified at its redeclaration shall be the same as at its initial
39
  declaration.
40
 
 
 
41
  ``` cpp
42
  struct S {
43
  class A;
44
  enum E : int;
45
  private:
46
  class A { }; // error: cannot change access
47
  enum E: int { e0 }; // error: cannot change access
48
  };
49
  ```
50
 
51
- In a derived class, the lookup of a base class name will find the
52
- injected-class-name instead of the name of the base class in the scope
53
- in which it was declared. The injected-class-name might be less
54
- accessible than the name of the base class in the scope in which it was
55
- declared.
 
 
 
 
56
 
57
  ``` cpp
58
  class A { };
59
  class B : private A { };
60
  class C : public B {
61
  A* p; // error: injected-class-name A is inaccessible
62
  ::A* q; // OK
63
  };
64
  ```
65
 
 
 
 
5
 
6
  An *access-specifier* specifies the access rules for members following
7
  it until the end of the class or until another *access-specifier* is
8
  encountered.
9
 
10
+ [*Example 1*:
11
+
12
  ``` cpp
13
  class X {
14
  int a; // X::a is private by default: class used
15
  public:
16
  int b; // X::b is public
17
  int c; // X::c is public
18
  };
19
  ```
20
 
21
+ — *end example*]
22
+
23
  Any number of access specifiers is allowed and no particular order is
24
  required.
25
 
26
+ [*Example 2*:
27
+
28
  ``` cpp
29
  struct S {
30
  int a; // S::a is public by default: struct used
31
  protected:
32
  int b; // S::b is protected
 
35
  public:
36
  int d; // S::d is public
37
  };
38
  ```
39
 
40
+ *end example*]
41
+
42
+ [*Note 1*: The effect of access control on the order of allocation of
43
+ data members is described in  [[class.mem]]. — *end note*]
44
 
45
  When a member is redeclared within its class definition, the access
46
  specified at its redeclaration shall be the same as at its initial
47
  declaration.
48
 
49
+ [*Example 3*:
50
+
51
  ``` cpp
52
  struct S {
53
  class A;
54
  enum E : int;
55
  private:
56
  class A { }; // error: cannot change access
57
  enum E: int { e0 }; // error: cannot change access
58
  };
59
  ```
60
 
61
+ *end example*]
62
+
63
+ [*Note 2*: In a derived class, the lookup of a base class name will
64
+ find the injected-class-name instead of the name of the base class in
65
+ the scope in which it was declared. The injected-class-name might be
66
+ less accessible than the name of the base class in the scope in which it
67
+ was declared. — *end note*]
68
+
69
+ [*Example 4*:
70
 
71
  ``` cpp
72
  class A { };
73
  class B : private A { };
74
  class C : public B {
75
  A* p; // error: injected-class-name A is inaccessible
76
  ::A* q; // OK
77
  };
78
  ```
79
 
80
+ — *end example*]
81
+