Original Post
Okay the problem occurs in my implementation file. I first declare a list, add some numbers to it, then I declare an iterator and try to point it towards the list but no luck.
[source lang="cpp"]#include
#include "SingleListNode.h"
#include "SingleLinkedList.h"
#include "SingleListIterator.h"
using namespace std;
int main()
{
// create a new linked list.
SLinkedList list;
// insert 10, 20 and 30.
list.Append( 10 );
list.Append( 20 );
list.Append( 30 );
cout << "the list contains: ";
// create a new iterator, and make it point to the
// beginning of the list.
SListIterator itr(list);
// loop through the list while the iterator is valid.
for( itr.Start(); itr.Valid(); itr.Forth() )
{
cout << itr.Item() << ", ";
}
// reset the iterator to the beginning again.
itr.Start();
cin.get();
return 0;
}[/source]
I keep on getting this error:
\desktop\singly linked list\singly linked list\example.cpp(23): error C2664: 'SListIterator::SListIterator(SLinkedList *,SListNode *)' : cannot convert parameter 1 from 'SLinkedList' to 'SLinkedList *'
1> with
1> [
1> Datatype=int
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
[source lang="cpp"]#include
#include "SingleListNode.h"
#include "SingleLinkedList.h"
#include "SingleListIterator.h"
using namespace std;
int main()
{
// create a new linked list.
SLinkedList
// insert 10, 20 and 30.
list.Append( 10 );
list.Append( 20 );
list.Append( 30 );
cout << "the list contains: ";
// create a new iterator, and make it point to the
// beginning of the list.
SListIterator
// loop through the list while the iterator is valid.
for( itr.Start(); itr.Valid(); itr.Forth() )
{
cout << itr.Item() << ", ";
}
// reset the iterator to the beginning again.
itr.Start();
cin.get();
return 0;
}[/source]
I keep on getting this error:
\desktop\singly linked list\singly linked list\example.cpp(23): error C2664: 'SListIterator
1> with
1> [
1> Datatype=int
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called