Please use code tags when posting code.
Code:
test(const test& obj)
{
  i = new int(*obj.i);
}
You will also need a destructor and an implementation of the assignment operator.