[source lang="cpp"]#include <iostream>
#include "SingleListNode.h"
#include "SingleLinkedList.h"
#include "SingleListIterator.h"
using namespace std;
int main()
{
// create a new linked list.
SLinkedList<int> 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<int> 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<Datatype>::SListIterator(SLinkedList<Datatype> *,SListNode<Datatype> *)' : cannot convert parameter 1 from 'SLinkedList<Datatype>' to 'SLinkedList<Datatype> *'
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