title: Does rule of three/five apply to inheritance and virtual destructors?
body: <p>Let's assume we have a very basic <code>class A</code>:</p>
  
  <pre><code>class A {
      public:
          void SetName(const std::string&amp; newName) {
              m_name=newName;
          }
  
          void Print() const {
              std::printf("A::Print(). Name: %s\n",m_name.c_str());
          }
      private:
          std::string m_name;  
  };
  </code></pre>
  
  <p>We want to extend this class with <code>class B</code> so we add our virtual destructor, change a member to <code>virtual</code> and change <code>private</code> to <code>protected</code> for inh:</p>
  
  <pre><code>class A {
      public:
          virtual ~A() {}
  
          void SetName(const std::string&amp; newName) {
              m_name=newName;
          }
  
          virtual void Print() const {
              std::printf("A::Print(). Name: %s\n",m_name.c_str());
          }
      protected:
          std::string m_name;
  
  };
  
  class B : public A {
      public:
          virtual void Print() const {
              std::printf("B::Print(). Name: %s\n",m_name.c_str());
          }
  };
  </code></pre>
  
  <p>Now since we added a destructor in <code>class A</code>  do we need to create a copy constructor and copy operator like so?</p>
  
  <pre><code>class A {
      public:
          virtual ~A() {}
  
          A() = default;
          A(const A&amp; copyFrom){
              *this = copyFrom;
          }
          virtual A&amp; operator=(const A&amp; copyFrom){
              m_name=copyFrom.m_name;
              return *this;
          };
  
          void SetName(const std::string&amp; newName) {
              m_name=newName;
          }
  
          virtual void Print() const {
              std::printf("A::Print(). Name: %s\n",m_name.c_str());
          }
      protected:
          std::string m_name;
  
  };
  </code></pre>
  
  <p>To me this seems unnecessary as the default copy operator and copy constructor would do the same thing.</p>