How to do a clone of an object?

I have one more question. Say i have a class as below:

class A extends base;
local bit valid;

function new();
 valid = 0;
endfunction

function void copy(base x);
 class abc;
 If ($cast(abc, x)) 
   valid = abc.valid;
endfunction
endclass

the above code is valid, but is it safe to directly access local members of an object?