Please help me its urgent...
I have a MSDN Queue class, I need your suggestion can I make a message class and enqueue its objects as an element.
// new.cpp : main project file.
#include "stdafx.h"
#include "message.h"
using namespace System;
using namespace System::Collections;
void PrintValues( IEnumerable^ myCollection );
void PrintValues( IEnumerable^ myCollection )
{
IEnumerator^ myEnum = myCollection->GetEnumerator();
while ( myEnum->MoveNext() )
{
Object^ obj = safe_cast<Object^>(myEnum->Current);
Console::Write( " {0}", obj );
}
Console::ReadLine();
}
int main(array<System:: String ^> ^args)
{
Console::WriteLine(L"Hello World");
Queue^ myQ = gcnew Queue;
message m1= gcnew message(101);
myQ->Enqueue( m1);
myQ->Enqueue( "World" );
myQ->Enqueue( "!" );
// Displays the properties and values of the Queue.
Console::WriteLine( "myQ" );
Console::WriteLine( "\tCount: {0}", myQ->Count );
Console::Write( "\tValues:" );
PrintValues( myQ );
//system("pause");
return 0;
}
**********************************************
my created class is this
message.h
class message
{
int MsgId;
char properties;
message(int Id);
};
#include "message.h"
int message::getId()
{
return this.MsgID;
}
void message::setId(int Id)
{
this.MsgID=Id;
}
message::message(int Id)
{
this. MsgID=Id;
}