About the copy constructor and pointers
<p>I'm reading through an example in primer and something which it talks about is not happening. Specifically, any implicit shallow copy is supposed to copy over the address of a pointer, not just the value of what is being pointed to (thus the same memory address). However, each of the pos properties are pointing to two different memory addresses (so I am able to change the value of one without affecting the other). What am I doing wrong?</p>

<p>Header</p>

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

class Yak
{
public:
    int hour;
    char * pos;
    const Yak &amp; toz(const Yak &amp; yk);
    Yak();
};
</code></pre>

<p>END HEADER</p>

<pre><code>using namespace std;
const Yak &amp; Yak:: toz(const Yak &amp; yk)
{
    return *this;
}

Yak::Yak()
{
    pos = new char[20];

}

int _tmain(int argc, _TCHAR* argv[])
{
    Yak tom;
    tom.pos="Hi";

    Yak blak = tom.toz(tom);


    cout &lt;&lt; &amp;blak.pos &lt;&lt; endl;
    cout &lt;&lt; &amp;tom.pos &lt;&lt; endl;


    system("pause");
    return 0;
}
</code></pre>
