the dot operator (.) needs an object on its left. An object is not a class name, nor is it a template name:
1 2 3 4 5
string foo; // <- string is the class. foo is the object
foo.length(); // <- Correct. Gets the length of the foo object
string.length(); // <- Error. Makes no sense. What string are you getting the length of?
Also... UnorderedLinkedList isn't even a class -- it's a template, and in order to make it a class you have to tell it what type you want for the 'Type' template argument.
So 2 changes:
1) Give UnorderedLinkedList its necessary template argument
2) Create an object
1 2 3
UnorderedLinkedList<int> mylist; // <- <int> tells it that Type=int. mylist is now the object
mylist.insertFirst(AData); // <- now this makes sense.
what if the data is a class? because i wanted to store a collection of information into the list.
I'm sorry, I forgot to mention that Data is a class as follows:
You went through the trouble of making UnorderedLinkedList a template so that you could pick and choose what type you want for the 'Type' argument. This means you can make a list of whatever you want: