Hahaha!
You inverted the syntax for getting a pointer and to dereference it!
To get a ListNode *, you should return this->next, since it already is a ListNode *. It's like when you want to get an int, you don't first convert it to double. You just pass it.
To get the object this->next points to, you dereference it: *this->node.
Depending on the class, it may not be possible to make a usable copy of the object.
Don't leave so many (or, in fact, any at all) lines between
template
and
class
. They're supposed to be adjacent:
1 2
|
template <class Type>
class ListNode
| |
getData() says it returns a ListNode *, when data is a Type.