title: Updating a classes' variable in a constructor through pass by reference?
body: <p>Blazing ahead with newfound knowledge of SystemVerilog's inner workings I've set out to use one of these fandangled pass-by-reference features to update a classes' counter in the constructor of another class. The setup (stripped to the basics) looks somewhat like this:</p>
  
  <pre><code>class my_queue;
    int unsigned num_items; //Want to track the number of items this Queue has seen.
  
    function push_new_item();
       item new_item = new(num_items);
    endfunction
  
  endclass
  
  class parent_item;
     int unsigned x_th_item;
     function new(ref int unsigned num_items);
        x_th_item = num_items;
        num_items += 1; //This should increase the counter in num_items.
     endfunction
  endclass
  
  class item extends parent_item;
     function new(ref int unsigned num_items);
        super.new(num_items);
     endfunction
  endclass
  </code></pre>
  
  <p>The issue is that my compiler is complaining about an</p>
  
  <pre><code>Illegal connection to the ref port 'num_items' of function/task parent_item::new, formal argument should have same type as actual argument.
  </code></pre>
  
  <p>I have an idea on how to fix this: Moving the increment after the call to new() in push_new_items.<br>
  But then I still won't know how to correctly use pass-by-refrence in SV so what's causing the error?<br>
  Is it the other pass-by-reference or maybe a syntactical error?</p>