《C++ Primer》第五版,中文版。42 页。
我记得有定义成员有下划线加名字的方式,为的是与构造函数的参数区分开,但是书上说函数之外不能以下划线开头。
PHP中文网2017-04-17 13:50:18
Because it is in a class, it can start with an underscore followed by a lowercase letter, but it cannot start with a double underscore or an underscore followed by an uppercase letter. Please refer to here: http://stackoverflow.com/questions/228783/what-are- the-rules-about-using-an-underscore-in-a-c-identifier
高洛峰2017-04-17 13:50:18
As long as the defined member name complies with C++ specifications, it is OK.
The C++ standard has never stipulated that members outside functions cannot start with an underscore.
This may be useful to you https://www.zhihu.com/question/22419899
高洛峰2017-04-17 13:50:18
There is a way to write private attributes starting with an underscore.
Whether it can be written like this depends on the team's coding standards.