使用:
参考:https://www.cnblogs.com/Star-Lit/p/8623050.html
Triangular& Triangular::
copy(Triangular *this,const Triangular &rhs)
{
this->_length=rhs._length;
this->_beg_pos=rhs._beg_pos;
this->_next-rhs._beg_pos-1;
};
//调用方式被编译器从tr1.copy(tr2);转换为
//tr1变成this指针所指的对象
copy(&tr1,tr2);
Triangular& Triangular::
copy(const Triangular &rhs)
{
//检查两个类对象是否相同
if(this!=&rhs)
{
_length=rhs._length;
_beg_pos=rhs._beg_pos;
_next=_rhs._beg_pos-1;
}
return *this;
}
tr1.copy(tr2);