need OOP info for copy method

Status
Not open for further replies.

JAYSHAH

Newbie level 3
Joined
Sep 1, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
INDIA
Visit site
Activity points
1,317
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.
 
Last edited:

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.

Also, a great place to help you with UVM issues is on the forums at https://verificationacademy.com/
 

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);

Hope this helps.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…