I’ve written 2 classes (AVL and Stack for my Data Structures lecture) and I’m trying to call this function:
int MyStack::Push(avlnode *x)
in a function of the AVL class:
trace.Push(temp);
trace is a MyStack object
and temp a pointer to avlnode (which is a struct).
When I try to compile the code I get the following error:
In member function 'int MyAVLTree::Insert(int)':
error: no matching function for call to 'MyStack::Push(MyAVLTree::avlnode*&)'
note: candidates are: int MyStack::Push(avlnode*)|
I can reproduce your error with the snippets provided further down in this post.
My guess is that you’ve put a forward declaration in the wrong place, probably in the global scope near
MyStack(so that you can use it inside of the mentioned class).…
…
…