i have a linked list in my program that is circular . i have to print from a specific number in the list and when i do im getting an error. now this function is a constant and must stay a constant, the line with the stars is giving me this error
(C:\Windows\Desktop\Project5\Functions.cpp(117) : error C2166: l-value specifies const object)
Code:
void ClosedList::PrintFrom(int item) const
{
NodeType* currPtr = head->backlink;
NodeType* newNodePtr = new NodeType;
newNodePtr->component = item;
newNodePtr->link = head;
head = newNodePtr;*******************************
newNodePtr = NULL;
if(!IsEmpty())
{
do
{
cout << currPtr->component << " ";
currPtr = currPtr->backlink;
}while (currPtr != head);
cout << currPtr->component << " ";
}
cout <<endl;
bool ClosedList::IsEmpty() const
{
return (head == NULL);
}