I have queue class as below
public class queue
{
public:
queue();
~queue();
bool Empty() const;
void Enqueue(message^);
void Dequeue();
void DisplayAll() const;
private:
gcroot<String^> bindingkey;
queue(queue const& obj);
ListNode* head;
ListNode* tail;
};
queue::queue():head(nullptr), tail(nullptr) {}
queue::~queue()
{
while (head != nullptr)
{
Dequeue();
}
}
//bool queue::Empty() const
//{
// return head == nullptr;
//}
//String^ queue::Next() const
//{
// return head->msg;
//}
void queue::Enqueue(message^ key)
{
if (head == nullptr)
{
head = tail = new ListNode(key);
}
else
{
tail->next = new ListNode(key);
tail = tail->next;
}
}
void queue::Dequeue()
{
ListNode* temp = head->next;
delete head;
head = temp;
}
void queue::DisplayAll() const
{
for (ListNode* p = head; p; p = p->next)
{
Console::WriteLine("the element is {0}", p->msg->routingk);
}
}
int main(array<System::String^> ^args)
{
//four queues are created and added to the list of the queues
queue *usa = new queue;
queue *weather = new queue;
queue *news = new queue;
queue *europe = new queue;
}
Can I have the name of the queue as STRING. PLEASE HELP.