含义:代码中的操作符

Meaning of : operator in code

本文关键字:操作符 代码 含义      更新时间:2023-10-16

我试图理解线性碰撞器I/O项目的一些代码。我是c++新手,我无法理解下面一行在我下面复制的代码中意味着什么。

顶点:顶点():处理器("顶点"),_output (0)

上面这行代码中的:是什么意思?提前感谢大家!

代码在

下面
#include <marlin/Global.h>
#include "lcio.h"
//more .h files that I have not shown here
using namespace lcio ;
using namespace marlin ;
using namespace std;
vertex avertex ;
 vertex::vertex():Processor("vertex"),_output(0)
{
    _description = "Measure Bush Quantities" ;
std::vector<std::string> branchCollections;
branchCollections.push_back(std::string("Branch_ECALEndcap"));
branchCollections.push_back(std::string("Branch_HCALEndcap"));
registerProcessorParameter("branchCollections" ,                      "Name of Branch Collections" ,_branchCollections,branchCollections);

_treeFileName="vertex.root";
registerProcessorParameter( "TreeOutputFile" , 
        "The name of the file to which the ROOT tree will be written" ,
        _treeFileName ,
        _treeFileName);

}
void vertex::init() {
 //not important
}

void vertex::processEvent( LCEvent * evtP ) 
{       
    //not important
}

以下代码

vertex::vertex():Processor("vertex"),_output(0)

是顶点类的构造函数的定义。列之后是基类的构造函数(在本例中是Processor),然后是数据成员(output_)。大括号是构造函数体

是构造函数初始化列表的开始

::是作用域解析操作符,而:标志着成员初始化列表的开始。