I have a simple assignment function as follows:
LinkedList& LinkedList::operator=(const LinkedList &l) {
// handle self assignment
if (this == &l) {
return *this;
}
// free old elements of the list before the new elements from l are assigned
~*this();
// build the list as a deep copy of l (copy constructor handles empty case)
this(l);
return *this;
}
and whenever I run my program I get a error: ‘this’ cannot be used as a function
response. How do am I supposed to use the constructors in their actual context? Any help is greatly appreciated!