copy & swap in base and derived class
问题 I recently read about copy & swap and am now trying to implement the ctors in a base and derived class. I have the four constructors in both my base and derived class, however I am unsure how to implement the assignment operator of the derived class. explicit Base(int i) : m_i{i} {} Base(const Base & other) : m_i{other.m_i} Base(Base && other) : Base(0) { swap(*this, other); } Base & operator=(Base other) { swap(*this, other); return *this; } friend void swap(Base & a, Base & b) noexcept {