C++ 构造函数中前导下划线的含义是什么? [英] What is the meaning of leading underscores in a C++ constructor?
本文介绍了C++ 构造函数中前导下划线的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,我不是一个非常有经验的 C++ 程序员,但我想知道以下构造函数的参数中下划线的意义是什么?
OK I am not a very experienced C++ programmer, but I was wondering what is the significance of the underscores in the arguments of the following constructor?
class floatCoords
{
public:
floatCoords(float _x, float _y, float _width, float _height)
: x(_x), y(_y), width(_width), height(_height)
{
}
float x, y, width, height;
...
推荐答案
这只是一个方便的命名约定,它对语言没有任何意义.请确保您后面没有大写字母:C 中的双下划线 (__const) 是什么意思?
It's just a convenient naming convention, it means nothing to the language. Just be sure you don't follow it with an upper-case letter: What does double underscore ( __const) mean in C?
这篇关于C++ 构造函数中前导下划线的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文