static specifier
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Внутри класса, объявляет члены не связаны с конкретными примерами.
Original:
Inside a class, declares members not bound to specific instances.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Содержание |
[править] Синтаксис
| static class_attribute | |||||||||
| static class_method | |||||||||
[править] Notes
# Статические атрибуты должны быть определены вне класса
Original:
# static attributes must be defined outside the class
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
# Статической постоянной неотъемлемые атрибуты могут быть определены встроенные (до C++11)
Original:
# static constant integral attributes can be defined inline (до C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
# Внутри статических методов нет NJ указатель
Original:
# inside static methods there is no NJ указатель
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
# Статические методы не могут иметь другой класс-специфические функции спецификатор как cv, virtual или явном переопределения
Original:
# static methods cannot have other class-specific function specifier as cv, virtual or явном переопределения
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] См. также
[править] Пример
struct C { static void foo(); static int n; static const int m = 16; // inline inizialization }; int C::n = 0; // static attribute definition void C::foo() { // no reference to non-static members/methods can occur here }