title: C++ abstract class parameter error workaround
body: <p>The code snippet below produces an error:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class A
  {
  
  public:
  
    virtual void print() = 0;
  };
  
  void test(A x) // ERROR: Abstract class cannot be a parameter type
  {
    cout &lt;&lt; "Hello" &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Is there a solution/workaround for this error other/better than replacing</p>
  
  <pre><code>virtual void print() = 0;  
  </code></pre>
  
  <p>with  </p>
  
  <pre><code>virtual void print() = { }
  </code></pre>
  
  <p>EDIT: I want to be able to pass any class extending/implementing the base class A as parameter by using polymorphism (i.e.  <code>A* x = new B() ; test(x);</code> )</p>
  
  <p>Cheers</p>