Bad Boy JH
2011-10-01 09:27:47
I know I can strictly not change an array size, and that vectors would be better. However I am looking for simplicity on this small snippet of code in my assignment.
I need to have a variable amount of queues (yes queues as in linked lists, but I of course have to write the damn things), but to be set when the class constructor is called, and set there until it is deleted. How can I do it.
I have
In .h file
and in .cpp file
Queue is a template class, Carriage is another class.
I think that works, I want someone to double check it, or suggest a simpler way of doing it.
I don't need to learn vectors, so I really can't be bothered fiddling around with them either.
I need to have a variable amount of queues (yes queues as in linked lists, but I of course have to write the damn things), but to be set when the class constructor is called, and set there until it is deleted. How can I do it.
I have
In .h file
private:
int NumberOfQueues;
int UnloadingCapacity;
Queue<Carriage>* Queues;and in .cpp file
UnloadingJunction::UnloadingJunction(int NumOfQueues, int UnloadCapacity)
{
Queue<Carriage> tmpQueues[NumOfQueues];
Queues = tmpQueues;
NumberOfQueues = NumOfQueues;
UnloadingCapacity = UnloadCapacity;
}Queue is a template class, Carriage is another class.
I think that works, I want someone to double check it, or suggest a simpler way of doing it.
I don't need to learn vectors, so I really can't be bothered fiddling around with them either.