Skip to content

Update 02-usability.md #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/zh-cn/02-usability.md
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ class Magic {

### 强类型枚举

在传统 C++中,枚举类型并非类型安全,枚举类型会被视作整数,则会让两种完全不同的枚举类型可以进行直接的比较(虽然编译器给出了检查,但并非所有),**甚至枚举类型的枚举值名字不能相同**,这不是我们希望看到的结果
在传统 C++中,枚举类型并非类型安全,枚举类型会被视作整数,则会让两种完全不同的枚举类型可以进行直接的比较(虽然编译器给出了检查,但并非所有),**甚至同一个命名空间中的不同枚举类型的枚举值名字不能相同**,这通常不是我们希望看到的结果

C++11 引入了枚举类(enumaration class),并使用 `enum class` 的语法进行声明:

Expand Down