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_(f开发者_开发百科alse),
compute_pi_thread_(0),
pi_(0.0) {
pthread_mutex_init(&pixel_buffer_mutex_, NULL);
}
Or is this even multi-inheritance? Can someone enlighten me?
It's (probably) just a convention: often, private
variables are declared with a tailing underscore, so that one can easily recognize them.
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
. 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.
精彩评论