简体   繁体   English

在C ++中,多重继承类中的下划线符号是什么意思?

[英]in C++, what do the underscore signs in the multi-inheritance classes mean?

here is the code: 这是代码:

PiGenerator::PiGenerator(PP_Instance instance)
: pp::Instance(instance),
  graphics_2d_context_(NULL),
  pixel_buffer_(NULL),
  flush_pending_(false),
  quit_(false),
  compute_pi_thread_(0),
  pi_(0.0) {
  pthread_mutex_init(&pixel_buffer_mutex_, NULL);
}

Or is this even multi-inheritance? 还是这甚至是多重继承? Can someone enlighten me? 有人可以启发我吗?

(可能)只是一种约定:通常, private变量使用尾部下划线声明,以便人们可以轻松识别它们。

No, that isn't specific to multiple inheritance. 不,这并非特定于多重继承。 That's just the naming convention the original programmer decided to make. 那只是原始程序员决定制定的命名约定。

Those are actually fields of the class PiGenerator . 这些实际上是类的字段 PiGenerator They all constitute the initialization list , which provides values to the various fields of the class before the constructor is entered. 它们全部构成初始化列表 ,该初始化列表在输入构造函数之前为类的各个字段提供值。 In this example, pp::Instance is the only base class constructor involved, and the rest are field initializations. 在此示例中, pp::Instance是唯一涉及的基类构造函数,其余为字段初始化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM