title: error: no ‘’ member function declared in class ''
body: <p>I'm trying to create a class containing a virtual function, which i would like to inherit in two child classes.</p>
  
  <p>I know some people already asked this (<a href="https://stackoverflow.com/questions/6375560/error-because-function-is-pure-virtual-within-class">here</a> and <a href="https://stackoverflow.com/questions/12615904/g-because-the-following-virtual-functions-are-pure-with-abstract-base-class">there</a> for example), but i couldn't understand the answers.</p>
  
  <p>So i made a simplified example code of what i'm trying : </p>
  
  <pre><code>//Mother .h file 
  
  #ifndef _MOTHER_H_
  #define _MOTHER_H_
  #include &lt;iostream&gt;
  
  class Mother
  {
   protected :
     std::string _name;
   public:
     Mother(std::string name);
     ~Mother();
     virtual std::string getName() = 0; 
  };
  
  #endif
  
  //Mother .cpp file
  
  #include "Mother.h"
  
  Mother::Mother(std::string name)
  {
    this-&gt;_name = name; 
  }
  
  Mother::~Mother()
  {
  }
  
  
  //Child.h file
  
  #ifndef _CHILD_H_
  #define _CHILD_H_
  #include "Mother.h"
  
  class Child : public Mother
  {
   private : 
     std::string _name;
   public:
     Child(std::string name);
     ~Child();
  };
  
  #endif
  
  
  //Child .cpp file
  
  #include "Mother.h"
  #include "Child.h"
  
  Child::Child(std::string name) : Mother(name)
  {
    this-&gt;_name = name;
  }
  
  Child::~Child()
  {
  }
  
  std::string Mother::getName()
  {
    return this-&gt;_name;
  }
  </code></pre>
  
  <p>Here is my main.cpp file :</p>
  
  <pre><code>//Main.cpp file
  #include "Child.h"
  
  int main()
  {
     Child l("lol");
  
     std::cout &lt;&lt; l.getName() &lt;&lt; std::endl;
  
     Mother&amp; f = l;
  
     std::cout &lt;&lt; f.getName() &lt;&lt; std::endl;
  
     return 0;
   }
  </code></pre>
  
  <p>Here's what the compilator says : 
  <strong>(compiling with g++ *.cpp -W -Wall -Wextra -Werror)</strong></p>
  
  <pre><code>main.cpp: In function ‘int main()’:
  main.cpp:5:9: error: cannot declare variable ‘l’ to be of abstract type‘Child’
  In file included from main.cpp:1:0:
  Child.h:8:7: note:   because the following virtual functions are pure within ‘Child’:
  In file included from Child.h:6:0,
               from main.cpp:1:
  Mother.h:14:23: note:   virtual std::string Mother::getName()
  </code></pre>
  
  <p>What am i doing wrong ?</p>
  
  <p>(sorry if i made some  english mistakes, i am not a native speaker).</p>