C++关键字

来源:互联网 发布:c语言预处理 编辑:程序博客网 时间:2024/06/16 13:36

[图片来源:cppreference]

1、const/volatile

The const (and volatile) qualifier binds to the left. This means that any time you see const, it is being applied to the token to the left of it. There is one exception, however; if there's nothing to the left of the const, it binds to the right, instead. It's important to remember these rules.

Another blog about const

Another blog about volatile


2、explicit

You have a MyString(int size) class with a constructor that constructs a string of the given size. You have a function print(const MyString&), and you call it with print(3). You expect it to print "3", but it prints an empty string of length 3 instead.


3、virtual

http://www.stroustrup.com/bs_faq2.html


4、mutable

 A mutable member in Class can be modified in const member function.


5、override/final

Another blog




Working……  To be detailed.


0 0
原创粉丝点击