Why Can't I do this in C++?
<p>Why the method getName() is wrong ?</p>

<pre><code>#include &lt;iostream.h&gt;
#include &lt;string.h&gt;

class People
{
public:
    char* getName();
    void  setName(char* n);

private:
    char* name;
};

void People::setName(char* n)
{
    name = new char(strlen(n));
    strcpy(name,n);
}  

char* People::getName()
{
    return name;   
}
</code></pre>
