Skip to content
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

C++基础语法:“39、volatile、mutable和explicit关键字的用法”(勘误) #19

Open
Linke66 opened this issue Oct 23, 2021 · 0 comments

Comments

@Linke66
Copy link

Linke66 commented Oct 23, 2021

错误位置:
image

错误原因:
Mutable是用来修饰类的成员变量的,而不是修饰成员函数的。

来源和代码验证:
来源-C++ Primer 245页
image

代码验证-加在函数的参数列表后大括号前面会报错
image

我认为划红线的地方应该改为:
那么这个成员变量应该被mutable来修饰,mutable关键字在成员变量声明的时候加在最前方。

@Linke66 Linke66 changed the title C++基础-39、volatile、mutable和explicit关键字的用法 C++基础语法:39、volatile、mutable和explicit关键字的用法 Oct 23, 2021
@Linke66 Linke66 changed the title C++基础语法:39、volatile、mutable和explicit关键字的用法 C++基础语法:“39、volatile、mutable和explicit关键字的用法” Oct 23, 2021
@Linke66 Linke66 changed the title C++基础语法:“39、volatile、mutable和explicit关键字的用法” C++基础语法:“39、volatile、mutable和explicit关键字的用法”(勘误) Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant