In reply to muku_383:
Have you reviewed the link I gave you?
There is nothing special about copying an array of int versus a singular int. You just make a simple assignment like you did with o. Also, copy() should not do any class construction. Just call the inner copy.
class inner;
int i = 5;
int j[];
function void copy(inner from);
if (from == null) return;
this.i = from.i;
this.j = from.j;
endfunction
endclass
class outer;
int o = 10;
int k[];
inner in = new();
function void copy (outer from);
if (from == null) return;
this.o = from.o;
this.k = from.k;
this.in.copy(from.in);
endfunction
endclass
module c_copy();
outer obj1, obj2;
initial begin
obj1 = new();
obj2 = new();
obj2.copy(obj1);
obj1.o = 20;
obj1.in.i = 30;
$display(" obj1.o=%0d, obj1.in.i =%0d",obj1.o, obj1.in.i);//20,30
$display(" obj2.o=%0d, obj2.in.i =%0d",obj2.o, obj2.in.i);//10,5
end
endmodule
P.S. Please use code tags.