In writing a copy constructor for a class that holds a pointer to dynamically allocated memory, I have a question.

How can I specify that I want the value of the pointer of the copied from object to be copied to the pointer of the copied to object. Obviously something like this doesn't work...

```
*foo = *bar.foo;

```

because, the bar object is being deleted (the purpose of copying the object in the first place), and this just has the copied to object's foo point to the same place. 

What is the solution here? How can I take the value of the dynamically allocated memory, and copy it to a different address?