Interface class as function argument (with ref)

In reply to dave_59:

In reply to avek:
ref arguments require equivalent types between the formal and actual arguments types. formal type ‘word’ is of type my_word, and actual is of type testword.
There is no need to use a ref argument here. Please see Const ref - SystemVerilog - Verification Academy

Thank you for fast reply!
Maybe it was a bad example by me, and when using functions for printing, there is of cause no need to use a ref argument. But if i want to change structures that i send to ‘my_user’ - for example elements of queue. If I don’t use ‘ref’, such elements would be changed only inside ‘my_user’ because of copying by value.

I have found the solution:

To use declaration of the interface class,and send it to ‘my_user’ instead of ‘testword’ object, such as:


my_word word_pointer;
word_pointer=_word;
user.use_interface(word_pointer); 

But maybe there is better solution, and you’ll point me on it.
Thank you in advance!