Skip to content

Commit e5d0518

Browse files
committed
fix inline static
1 parent 0e07608 commit e5d0518

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/cpp_tricks.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,17 @@ vector<string> spilt(string str) {
343343
344344
```cpp
345345
struct Class {
346-
static Class instance;
346+
static int member;
347347
};
348348
```
349349

350-
会报错 `undefined reference to 'Class::instance'`。这是说的你需要找个 .cpp 文件,写出 `Class Class::instance` 才能消除该错误。
350+
会报错 `undefined reference to 'Class::member'`。这是说的你需要找个 .cpp 文件,写出 `int Class::member` 才能消除该错误。
351351

352352
C++17 中,只需加个 `inline` 就能解决!
353353

354354
```cpp
355355
struct Class {
356-
inline static Class instance;
356+
inline static int member;
357357
};
358358
```
359359

0 commit comments

Comments
 (0)