Files
2025-10-25 03:02:53 +03:00

1.7 KiB
Raw Permalink Blame History

[class.static.general]

11 Classes [class]

11.4 Class members [class.mem]

11.4.9 Static members [class.static]

11.4.9.1 General [class.static.general]

1

#

A static member s of class X may be referred to using the qualified-id expression X::s; it is not necessary to use the class member access syntax ([expr.ref]) to refer to a static member.

A static member may be referred to using the class member access syntax, in which case the object expression is evaluated.

[Example 1: struct process {static void reschedule();}; process& g();

void f() { process::reschedule(); // OK, no object necessary g().reschedule(); // g() is called} — end example]

2

#

Static members obey the usual class member access rules ([class.access]).

When used in the declaration of a class member, the static specifier shall only be used in the member declarations that appear within the member-specification of the class definition.

[Note 1:

It cannot be specified in member declarations that appear in namespace scope.

— end note]