Hey guys, first of all thanks for the time to even read this. Basically, Ive had some trouble in figuring out how to get this operator overloading to work. I think I'm having trouble in the functions calls that are within this function. These functions that are giving me trouble currently do not get the job done, which isnt really my main problem. Im having trouble understanding the syntax of calling the functions that are used within them. Any help would be greatly appreciated.
The current situation:
templatized class object of List<L>
another class object of List<L>::Iterator
and another one for the nodes
here is the implementation sections for the copy function and the operator = function in which I am having trouble...
Copy Function:
template <typename L>
List<L>::List(const List<L>& another)
{
List<L> ();
Iterator<L> begin;
another.Iterator<L>::begin;
while (another.Iterator != last)
{
insert(another.Iterator<L>::get());
another.Iterator<L>::next;
}
if (another.Iterator==last)
{
insert (another.Iterator<L>::get());
}
}
The implementation of the = operator overloading
template <typename L>
const List<L> List<L>::operator=(const List<L>& another)
{
List<L> anotherTemp(const List<L>& another);
anotherTemp.Iterator<L> begin();
while (anotherTemp.Iterator != anotherTemp.last)
{
pushback (anotherTemp.Iterator->data);
anotherTemp.Iterator.next();
}
pushback (anotherTemp.Iterator->data);
return *this;
}
Im not really worried about functionality currently (i can work on that later,) im just worried about getting it to compile with the proper syntax (which you can probably tell I am having trouble with.) Currently, my largest problem is getting my copy constructor to get the outcome to be of a class type =(
The following are the various errors I am getting:
basically a couple others like this:
68:error: 'anotherTemp' is not a class or namespace
71:error: request for member 'Iterator' in 'anotherTemp [with L=std::string]', which is of non-class type 'List(std::string) ()(const List(std::string)&)'
one more is 76:error: 'pushback' was not declared in this scope
( Here is the pushback declaration: void pushBack(L s); )
thanks again, if this is too much or too little lemme know! thanks again!
EDIT::: its a doubly linked array, my topic was wrong im sorry!