I have a simple query, I am using code for "QUEUE IMPLEMENTATION USING SINGLE LINKED LIST" http://ds4beginners.wordpress.com/2006/12/17/queue-implementation-using-single-linked-list/ for my program but having an issue if you pleas help me.
public class queue
{
gcroot<message^> msg;
queue* next;
public:
queue();
queue* enqueue(queue*,message^);
queue* dequeue(queue*);
void queue_display(queue*);
void setbinding(String^);
String^ getbinding(void);
}object, *head=nullptr, *tail=nullptr;
the rest of queue functions are same as in the link . In the main function I have defined these queues.when I tried to insert element is "weather" queue and display it shows the same element in all the queues declared. Can you help me why this happening.
//main function
queue* weather = new queue();
queue* news = new queue();
//inserting element is queue
head= weather->enqueue(head,(gcnew message("*144")));
//displaying queue
Console::WriteLine("the items in the queue 'news' are");
news->queue_display(head);
Console::WriteLine("the items in the queue 'weather' are");
weather->queue_display(head);
Hoping best from your side