That said, the way to create a copy on the heap is this:
struct wheel
{
wheel *copy;
wheel()
{
copy = new wheel(*this);
}
//also needs copy constructor, assignment, and destructor, to handel freeing correctly.
};
Even better you can use this:
#include<memory>
struct wheel
{
std::shared_ptr<wheel> copy;
wheel()
{
copy.reset(new wheel(*this));
}
//copy constructor, assignment, and destructor not needed; free does not need to be called.
};