# Interface class as function argument (with ref)

**URL:** <https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, interface-class, function-argument, ref-direction\
**Created:** [February 4, 2019, 9:27am UTC](https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702 "2019-02-04T09:27:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![avek](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/6de8d8/32.png) [@avek](https://verificationacademy.com/forums/u/avek)\
**Post date:** [February 5, 2019, 10:51am UTC](https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702/3 "2019-02-05T10:51:56Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702/2):_

> _In reply to [avek](https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702/2):_  
> 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](https://verificationacademy.com/forums/systemverilog/const-ref#reply-51090)

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:

```verilog

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!

---

_[View the full topic](https://verificationacademy.com/forums/t/interface-class-as-function-argument-with-ref/35702)._
