When is the copy assignment operator called?

后端 未结 1 785
南笙
南笙 2020-12-17 18:15

When I read about copy constructor and copy assignment constructor, what I understood is that both gives away their properties one to another, and that both of them are decl

相关标签:
1条回答
  • 2020-12-17 18:58

    Test c = b is an initialization, not an assignment.

    If you had done this:

    Test c;
    c = b;
    

    Then it would have called the copy assignment operator.

    0 讨论(0)
提交回复
热议问题