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

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

问题描述

OK我不是一个非常有经验的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;
  ...


推荐答案

命名约定,它对语言没有意义。只需确保您不要使用大写字母:双下划线(__const)是什么意思在C?

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屋!

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