title: Instance of class which inherit from abstract class
body: <p>I have to create the instance of class which inherits from abstract class. 
  My code is really simple. It should create the instance of object class based on abstract class. The abstract class is template class aswell. Then I need to put this object into <code>storage</code> class which holds pointer to the object. Thats all. This task is some kind of homework. </p>
  
  <p>Is that even possible to create the instance of class based on abstract class? </p>
  
  <p>If yes - what I am doing wrong?
  If no - how can I make it similar? </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;memory&gt;
  
  // using namespace std;
  
  template&lt;typename type1, typename type2, typename type3&gt; class INTERFACE {
      protected:
          type1 x;
          type2 y;
          type3 name;
  
      public:
          virtual type1 setX() = 0;
          virtual type2 setY() = 0;
  };
  
  class child : public INTERFACE&lt;int, float, std::string&gt; {
      public:
          child(std::string z) {
              this-&gt;name = z;
          }
  
          int setX(int x) {
              this-&gt;x = x;
          } 
  
          float setY(float y) {
              this-&gt;y = y;
          }
  };
  
  class storage {
      private:
          std::shared_ptr&lt;child&gt; childPTR;
  
      public:
          void setPTR(const std::shared_ptr&lt;child&gt; &amp; pointer) {
              this-&gt;childPTR = pointer;
          }
  };
  
  int main(){
    std::shared_ptr&lt;child&gt; newChild(new child("xxx"));
    storage testStorage;
    testStorage.setPTR(newChild);
  
      return 0;
  }
  </code></pre>
  
  <p>Compiling Errors:</p>
  
  <pre><code>templates.cpp: In function ‘int main()’:
  templates.cpp:44:52: error: invalid new-expression of abstract class type ‘child’
       std::shared_ptr&lt;child&gt; newChild(new child("xxx"));
                                                      ^
  templates.cpp:18:7: note:   because the following virtual functions are pure within ‘child’:
   class child : public INTERFACE&lt;int, float, std::string&gt; {
         ^
  templates.cpp:14:23: note:  type1 INTERFACE&lt;type1, type2, type3&gt;::setX() [with type1 = int; type2 = float; type3 = std::__cxx11::basic_string&lt;char&gt;]
           virtual type1 setX() = 0;
                         ^
  templates.cpp:15:23: note:  type2 INTERFACE&lt;type1, type2, type3&gt;::setY() [with type1 = int; type2 = float; type3 = std::__cxx11::basic_string&lt;char&gt;]
           virtual type2 setY() = 0;
  </code></pre>