含义:代码中的操作符
Meaning of : operator in code
我试图理解线性碰撞器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_)。大括号是构造函数体
是构造函数初始化列表的开始
::
是作用域解析操作符,而:
标志着成员初始化列表的开始。
相关文章:
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 代码在main()中运行,但在函数中出现错误
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 编译包含字符串的代码时遇到问题
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 在Linux for Windows上编译C++代码时出错
- 我的字符计数代码计算错误.为什么
- 孤立代码块在结构中引发异常
- 在编译C++代码(具有dlib和opencv)到WASM时面临问题
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 如何重写复杂的c++代码行(嵌套的三元操作符)
- 将代码声明放入字中(引用操作符和解引用操作符混淆)
- 朋友操作符的代码示例?c++头文件,朋友在这里做什么
- 移植c++代码到VBScript,位操作符溢出
- c++到Java的代码移植使用位操作符和unsigned int
- 含义:代码中的操作符
- 为什么这段代码会产生一个指向逗号操作符的警告?
- c++代码中重载操作符时的错误