title: C++ - "Cannot declare parameter 'anonymous' to be of abstract type"
body: <p>I have this simple class (Alpha) and his abstract class (Beta). I'm unable to pass Alpha (Beta) objects to overwrite() function, because abstract class can't handle self type objects.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using std::cout;
  using std::endl;
  using std::ostream;
  
  class Beta {
      public:
          virtual int  read() const = 0;
          virtual void write(int) = 0;
          virtual void overwrite(Beta) = 0; // &lt;-- This is the problem
  };
  
  class Alpha : public Beta {
      public:
          int  read     () const;
          void write    (int);
          void overwrite(Alpha);
      private:
          int value;
  };
  
  int Alpha::read() const {
      return value;
  }
  void Alpha::write(int v) {
      value = v;
  }
  void Alpha::overwrite(Alpha A) {
      value = A.value;
  }
  
  int main () {
      Alpha A, B;
      A.write(8);
      B.write(6);
  
      cout &lt;&lt; "A: " &lt;&lt; A.read() &lt;&lt; endl; // 8
      cout &lt;&lt; "B: " &lt;&lt; B.read() &lt;&lt; endl; // 6
  
      A.overwrite(B);
  
      cout &lt;&lt; endl &lt;&lt; "A: " &lt;&lt; A.read(); // 6
      return 0;
  }
  </code></pre>
  
  <p>It gives me <code>[Error] cannot declare parameter '&lt;anonymous&gt;' to be of abstract type 'Beta'</code>. How to deal with it? It's a small code sample, but I need to solve this because I can't overload operators and declaring that type of functions correctly.</p>