In reply to Manoj J:
The first method is really a “construct a copy”, normally called the “clone” method.
The second method is a true copy from the object being passed as an argument to copy() to the implicit ‘this’ argument that copy was called on.
class A;
int al;
function A clone();
clone = new();
clone.copy(this);
endfunction
function void copy(A ab);
this.a=ab.a;
endfunction
endclass
And deep copy refers to copying classes that contains other class variables.