什么是在C ++的构造函数前导下划线的含义是什么? [英] What is the meaning of leading underscores in a C++ constructor?

查看:153
本文介绍了什么是在C ++的构造函数前导下划线的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,我不是一个非常有经验的C ++程序员,但我想知道什么是下划线在下面的构造函数的参数的意义是什么?

 类floatCoords
 {
 上市:
  floatCoords(浮动_x,_y浮动,浮动_width,浮动_height)
   :X(_x),Y(_y),宽度(_width),高度(_height)
  {  }
  浮动的x,y,宽度,高度;
  ...


解决方案

这只是一个方便的命名约定,没什么意思的语言。只要确保你不会用大写字母按照它:<一href=\"http://stackoverflow.com/questions/1449181/what-does-double-underscore-const-mean-in-c\">http://stackoverflow.com/questions/1449181/what-does-double-underscore-const-mean-in-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;
  ...

解决方案

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: http://stackoverflow.com/questions/1449181/what-does-double-underscore-const-mean-in-c

这篇关于什么是在C ++的构造函数前导下划线的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆