A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4659/basic.scope.class below:

[basic.scope.class]

6 Basic concepts [basic] 6.3 Scope [basic.scope] 6.3.7 Class scope [basic.scope.class]

The potential scope of a name declared in a class consists not only of the declarative region following the name's point of declaration, but also of all function bodies, default arguments, noexcept-specifiers, and brace-or-equal-initializers of non-static data members in that class (including such things in nested classes).

A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule.

A name declared within a member function hides a declaration of the same name whose scope extends to or past the end of the member function's class.

The potential scope of a declaration that extends to or past the end of a class definition also extends to the regions defined by its member definitions, even if the members are defined lexically outside the class (this includes static data member definitions, nested class definitions, and member function definitions, including the member function body and any portion of the declarator part of such definitions which follows the declarator-id, including a parameter-declaration-clause and any default arguments).

[Example:

typedef int  c;
enum { i = 1 };

class X {
  char  v[i];                         int  f() { return sizeof(c); }      char  c;
  enum { i = 2 };
};

typedef char*  T;
struct Y {
  T  a;                               typedef long  T;
  T  b;
};

typedef int I;
class D {
  typedef I I;                      };

end example]

The name of a class member shall only be used as follows:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4