Reputation: 93
First of all. I appreciate the help guys!
This is the problem.Trying to set one of list's edges to null
list[i].getAttachedNode(j) = 0;
This is the error.
Prj3.cpp:165:34: error: lvalue required as left operand of assignment
This is my list decleration.
Node list[47];
This is the attachedNode implementation.
Node* Node::getAttachedNode(int direction) {return attachedNode[direction];}
[b]Here is the block its contained in.
for(int i = 0; i<48; i++)
{
for(int j = 0; j<6; j++)
{
string info = g.returnInfo(i,j);
switch(j)
{
case 0:
list[i].setNodeName(info);
break;
case 1:
if(info.compare(null) == 0)
{list[i].getAttachedNode(j) = 0;}
break;
}
}
}
Upvotes: 0
Views: 872
Reputation: 258618
The error is pretty clear:
list[i].getAttachedNode(j)
is an r-value, so it can't be assigned to. Just have getAttachedNode
return a reference:
Node*& Node::getAttachedNode(int direction) {return attachedNode[direction];}
Upvotes: 1