Hey all.
Right now I'm working on algorithms, and so I wanted to make my own Linked List class (I do realize I'm reinventing the wheel, doesn't make it less fun :P).
I've also started using eclipse yesterday (just a note, in case I simply messed the IDE up).
Ok. So my Linked List contains 2 pointers, an integer (size) and a bunch of methods. Every item in the Linked List is called LinkedObject (which is a struct).
Linked Object looks like so:
Code:
template <class T>
struct LinkedObject
{
T object;
LinkedObject* next;
};
This is all fine, so I started making the LinkedList class, and ran into this problem:
Code:
template <class T>
class LinkedList
{
private:
LinkedObject* ListBegin, ListEnd; //2 pointers
int size; //size integer
public:
void Append(T ToAdd ) /*this first method adds an object to the end of the list*/
{
if(size==0)//if it's empty...
{
ListBegin = new LinkedObject<T>; /*make a new object in the beginning since the list is empty*/
ListBegin->object = ToAdd; /*NOTE THIS LINE! seemingly innocent statement: set the object in the LinkedObject ListBegin(which is a pointer) to the value the user wants to add*/
}
}
};
the error is there, eclipse throws me a "Field object could not be resolved and i have absolutely no idea onto why it would do that.