title: C++ Compiler Error: No matching function for call
body: <p>Look at the following code. What is wrong with it? The compiler gives the this error:</p>
  
  <blockquote>
    <p>In copy constructor <code>person::person(person&amp;)':
    No matching function for call to</code>person::copy(char*&amp;, char*&amp;)'
     candidates are: void person::copy(char*&amp;, const char*&amp;) "</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>class person
  {
    public:
      person();
      person(person &amp;);
  
    private:
      void copy(char*&amp;,const char*&amp;);
      char* name, *fathername,* address;
  };
  
  void person::copy( char*&amp; n, const char*&amp; p)
  {
    int result;
    result=strcmp(n,p);
    if(result!=0)
    {
      n=new char[strlen(p)+1];
      strcpy(n,p);
      n[strlen(p)]='\0';
    }
  }
  person::person(person &amp;object)
  {
    copy(name,object.name);
    copy(fathername,object.fathername);
    copy(address, object.address);
  }
  </code></pre>
  
  <p><strong>From the answers to this Question what I understood up until now is given by</strong>:
  the compiler does not allow to convert a reference to a constant reference because references are already constant. They can't point to a different memory location like pointer. Am I right?</p>