mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-04-05 11:41:28 +08:00
support bazel complie this project and format code.
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int count=0; // 全局(::)的count
|
||||
int count = 0; // 全局(::)的count
|
||||
|
||||
class A {
|
||||
public:
|
||||
static int count; // 类A的count (A::count)
|
||||
|
||||
static int count; // 类A的count (A::count)
|
||||
};
|
||||
// 静态变量必须在此处定义
|
||||
int A::count;
|
||||
int main() {
|
||||
::count=1; // 设置全局的count为1
|
||||
A::count=5; // 设置类A的count为2
|
||||
cout<<A::count<<endl;
|
||||
// int count=3; // 局部count
|
||||
// count=4; // 设置局部的count为4
|
||||
return 0;
|
||||
::count = 1; // 设置全局的count为1
|
||||
A::count = 5; // 设置类A的count为2
|
||||
cout << A::count << endl;
|
||||
// int count=3; // 局部count
|
||||
// count=4; // 设置局部的count为4
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user