How does copy constructor work?

后端 未结 5 820
感动是毒
感动是毒 2021-01-17 01:12

How does a copy constructor work in c++

Error 1 error C2064: term does not evaluate to a function taking 1 arguments c:\\users\\thuan\\dropbox\\homework\\css

5条回答
  •  旧巷少年郎
    2021-01-17 01:22

    You've already constructed object1 with the default constructor when you do

    IntSet object1;
    

    To copy consrtuct you need to change this to

    IntSet object1( object2 );
    

    at some point after defining object2 (you will probably want to swap the names of your two variables).

提交回复
热议问题