what is return type of assignment operator?

前端 未结 3 591
离开以前
离开以前 2020-11-29 02:44

I am just starting C++. I am a bit confused about the return type of assignment and dereference operator. I am following the book C++ Primer. At various occasions, the autho

3条回答
  •  离开以前
    2020-11-29 03:22

    I have seen similar issues, but I guess it would be best to use

    X& X::operator=(const X&);
    

    Using this, you will be able to reuse the object in a chain-assignment.

提交回复
热议问题