Initializing generic type that can be both primitive and object

I have defined my own class, Queue, which inherits from my own class, LinkedList. I have been using templates to allow Queues to be of int, string, etc types.

But now I want to be able to store objects in my Queue type. And so the problem I have is that in my LinkedList class, I have two instances where I initialize an instance of my generic type T to 0.

For instance, the removeFirst() method starts like this:

1
2
3
template <typename T>
T LinkedList<T>::removeFirst() {
	T a = 0;


And so the compiler complains that it can't convert from int to [in this case] Command&.

What to do?
T a = T();
Whoa, thanks. I did not know that. Seems useful!
Topic archived. No new replies allowed.