title: c++ clone function in abstract class
body: <p>in c++11 standard, if class B inherits from class A, then 'B is an A'. 
  However, i am still confused regarding this notion: 
  look at this code:</p>
  
  <pre><code>class Base {
  public: 
      virtual ~Base() {}
      virtual Base* clone() const = 0;
  };
  
  class Derived : public Base {
  public:
      virtual Base* clone() const {
          return new Derived(*this);
      }
      //&lt;more functions&gt;
  };
  </code></pre>
  
  <p>we returned a pointer to Base from Derived, but if using this approach in this code:</p>
  
  <pre><code>Derived* d1 = new Derived();
  Derived* d2 = d1-&gt;clone();
  </code></pre>
  
  <p>what we did is assigning <code>Base*</code> in <code>Derived*</code>!! </p>
  
  <p><strong>The Problem</strong>:<br>
  why this code does not compile? How could it be modified(and why?) in order to fit with the inheritance?</p>