Since you take the std::string by value, you should std::move it into storage, like this->name = std::move(name);.
I assume you're using these getters and setters for something in your demo? Generally getters and setters like this are not recommended unless there's some class invariant that they're upholding.
@TartanLlama we are not using tem for something beyond asking users to enter a name and then using that name to output info. What would be recommended here?
https://github.com/sinemakinci1/Cpp-Copilot-VSC-Demo/blob/9db124b0e801cfc5331261c1867d0d7e1fa4f6c6/src/user.cpp#L8
Since you take the
std::string
by value, you shouldstd::move
it into storage, likethis->name = std::move(name);
.I assume you're using these getters and setters for something in your demo? Generally getters and setters like this are not recommended unless there's some class invariant that they're upholding.