calling operators of base class… safe?

后端 未结 3 940
野趣味
野趣味 2020-12-29 02:38

Is following pattern ok/safe ? Or are there any shortcomings ? (I also use it for equality operators)

Derived& operator=(const Derived& rhs)
{
    st         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 03:12

    This is fine, but it's a lot more readable IMHO to call the base-class by name:

    Base::operator = (rhs);
    

提交回复
热议问题