Hi so I'm receiving an error that I have not yet encountered that says " Initial value of reference must be an lvalue" I am trying to write the implementation of a Stack with an ADT write-up that I have for linked list. Can someone please steer me in the right direction as to how to solve this error
1 2 3 4 5 6 7 8 9 10 11 12
//main.cpp
#include <iostream>
#include "List.h"
#include "Stack.h"
usingnamespace std;
int main()
{
Stack obj1;
obj1.push(2);//Initial value of reference must be an lvalue
cout << obj1.top();//Too few arguments in function call
}
The class function Stack::push takes the following parameters: (List<int> &l_dummy, int * const &v)
You are trying to pass it the following: 2
2 is not a (List<int> &l_dummy, int * const &v)
While I'm here, this Stack class makes no sense at all. It doesn't seem to be a stack; it's just some inconvenient functions for a user to use with a completely separate C++ list, that they're using as a stack.