What is the difference bw the following deep copy methods?
Class A;
int a;
.....
function A copy();
copy=new();
copy.a=this.a;
endfunction
.....
endclass
In the above code the return type is class and the object and function name are same. How can we write like this?
Class A;
int a;
....
function void copy(A ab);
this.a=new ab;
endfunction
....
endclass
In this case we are declaring a copy function to that we are passing the object. Can anyone tell me how the above codes will work?
Thank You,