I have my own LinkedList class, and when I'm creating an instance in the main i get the "expression must have class type" error. I have a default c'tor in the LinkedList class.
so when I'm trying to do this :
LinkedList<Animal> aL();
for (int i = 0; i < numOfAnimals; i++)
{
aL.addLast(*animals[i]);
}
cout << aL << endl;
it won't compile. but if I declare like this:
LinkedList<Animal> aL = LinkedList<Animal>();
it works. of course that the secont option isn't efficient, and i rather use the first one. can anyone explain me why it doesn't work or how to fix it? Thnaks!