Partho Rocko
Partho Rocko

Reputation: 73

How to pass generic class object as ref to another method?

I am trying to pass the AVLTree object reference to another method.

Definition of AVLTree class => class AVLTree : IComparable> where T : IComparable

Code

 Addhere(ref AVLTree<T> currentNode); //Passing like this


 public void Addhere(ref AVLTree<T> currentNode) //Receiving like this
        {

        }

Error is => "using the generic type AVLTree(T) requires 1 argument"

Upvotes: 0

Views: 49

Answers (1)

Beingnin
Beingnin

Reputation: 2422

You need to declare it outside and pass

AVLTree<T> currentnode = null; Addhere(ref currentnode);

Upvotes: 1

Related Questions