struct StackItem
{
string name;
StackItem *next;
};
typedef StackItem* nodePtr;
class Stack
{
private:
int numElements;
nodePtr top;
int count; // used for print count in recursive function
public:
a bunch of functions here that work, then theres this one
void push (StackItem *newItem)
{
newItem->next = top;
top = newItem;
nodePtr p, prev = nullptr;
p = new StackItem;
p->name = newItem; //this is the one i keep getting errors on
numElements++;
linkNodeByAcctNum(p, prev);
}
ok so this is my code for a function that will push or add a new item to the stack, for some reason i keep getting an error about that line saying "no viable overload '='" can anyone tell me what this means? (its the third last, i added a comment saying errors)
thanks!
Aren't you trying to assign a StackItem* to a string? I think the error message means that you don't have an overload of operator= that takes a StackItem* as parameter