tmp/tmpz9fk5dug/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="class.static.general">[[class.static.general]]</a>
|
| 2 |
+
|
| 3 |
+
A static member `s` of class `X` may be referred to using the
|
| 4 |
+
*qualified-id* expression `X::s`; it is not necessary to use the class
|
| 5 |
+
member access syntax [[expr.ref]] to refer to a static member. A static
|
| 6 |
+
member may be referred to using the class member access syntax, in which
|
| 7 |
+
case the object expression is evaluated.
|
| 8 |
+
|
| 9 |
+
[*Example 1*:
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
struct process {
|
| 13 |
+
static void reschedule();
|
| 14 |
+
};
|
| 15 |
+
process& g();
|
| 16 |
+
|
| 17 |
+
void f() {
|
| 18 |
+
process::reschedule(); // OK, no object necessary
|
| 19 |
+
g().reschedule(); // g() is called
|
| 20 |
+
}
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
— *end example*]
|
| 24 |
+
|
| 25 |
+
Static members obey the usual class member access rules
|
| 26 |
+
[[class.access]]. When used in the declaration of a class member, the
|
| 27 |
+
`static` specifier shall only be used in the member declarations that
|
| 28 |
+
appear within the *member-specification* of the class definition.
|
| 29 |
+
|
| 30 |
+
[*Note 1*: It cannot be specified in member declarations that appear in
|
| 31 |
+
namespace scope. — *end note*]
|
| 32 |
+
|