1

Hi what is the meaning of this line in this copy contructor?
*this = ref

Test::Test(const Test &ref){
  *this = ref;
}
Myno
  • 158
  • 2
  • 13
  • 1
    What part is not clear? Do you know the meaning of `this` etc? – user17732522 Jan 06 '22 at 01:07
  • Look at the copy assignment operator (`Test& Test::operator=(const Test&);`). What does that look like? Please put that into the question too. – Ted Lyngmo Jan 06 '22 at 01:19
  • Unrelated: there are often advantages to implementing the other way around with the assignment operator based on the copy constructor. See [What is the copy-and-swap idiom?](https://stackoverflow.com/questions/3279543) for a detailed discussion. – user4581301 Jan 06 '22 at 01:32

0 Answers0