ITPub博客

首页 > > > c++拷贝构造函数

c++拷贝构造函数

作者:suliver 时间:2019-09-26 14:34:50 0 删除 编辑

class CA

{

  public:CA(){cout<<"hello,world"<<endl;}

};

int main()

 {

   CA ca;

  CA cb=ca;

} 

outout:

hello,world

疑问:

为什么只有一个helloworld 输出呀,from ca to cb的拷贝过程中,不是定义了cb吗,也应该输出一个helloworld 呀?请教

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2370/viewspace-3118639/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-30

  • 博文量
    138
  • 访问量
    9095