gpt4 book ai didi

c++ - 请帮助理解C++ : operator

转载 作者:太空宇宙 更新时间:2023-11-04 16:19:42 25 4
gpt4 key购买 nike

<分区>

有人可以向我解释一下这个运算符在 C++ 中的作用吗?

class simplecanny
{
ros::NodeHandle nh_;
ros::NodeHandle n;
ros::Publisher pub ;
image_transport::ImageTransport it_;
image_transport::Subscriber image_sub_; //image subscriber
image_transport::Publisher image_pub_; //image publisher(we subscribe to ardrone image_raw)
std_msgs::String msg;
public:
*** simplecanny()
: it_(nh_) ***
{
image_sub_ = it_.subscribe("/ardrone/image_raw", 1, &simplecanny::imageCb, this);
image_pub_= it_.advertise("/arcv/Image",1);
}

~simplecanny()
{
cv::destroyWindow(WINDOW);
}

...

simplecanny() : it_(nh_) 构造函数中,我不熟悉 : it_(nh_) 部分。它有什么作用?这是运算符重载的情况吗?

提前致谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com