CSmth & CSmth::operator = (const CSmth & rhs)
{
return *this;
}
最佳答案
这是一个赋值运算符,所以你可以这样写:
CSmth a;
CSmth b;
a = b;
除了返回对第一个附录的引用之外,实际的实现没有任何用处。一个更标准的实现是:
CSmth & CSmth::operator = (const CSmth & rhs) {
if (this != &rhs) // protect against invalid self-assignment
{
do_whatever_required_to_copy_rsh_on_to_this;
}
return *this;
}
关于c++ - 在 C++ 中这种声明是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6656404/