hello friends. need help about copy info actually i wanna copy a class values which is already extended class. and i need that value in another extended class. so how to do it.??
any one have any idea abt it ? pls help me. here is the demo code i mean what i wanna say exactly.
class A extends other;
rand bit [1:0] in;
endclass
class B extends my;
int bit [1:0] in;
(so here i need this "bit" value same as that other's child class A. :?: )
endclass
so how should i do it ? :-? i'm in VLSI field. and i'm using UVM methodology.
You need to be much more explicit about what you want to do. When do you want the copy to happen? Or is it that you always want access to the 'in' member of class. You can't do anything in OOP without showing the procedural methods that acts upon the data. If you are using the UVM, it might help to show the UVM classes there represent. There might be an existing UVM mechanism to help you out.
First of all, both the classes A and B are no where related. I mean to say relation in terms of inheritance. When you talk about copy method of UVM, copy method attached with the object must accepts the same type, i mean base type should be same.
Here you can write a different copy method [conventional] which accepts object of class A type. like
copy_conv (A b); inside the B class. then probably you can call like B.copy_conv(a);