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 | |||||||||
[编辑] 注释
#静态属性,必须在类外定义
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:
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 }