How to Make an array of objects in visual c++ 2010
I need to create an array of objects to hold labels in visual c++ 2010,
i tried:
Object^ *labelArray;
labelArray=new Object^ [15];
but this error came up:
error C2728: 'System::Object ^' : a native array cannot contain this managed type
Did you mean 'array<System::Object ^>'?
So how to make this array and what does it mean by array<System::Object ^>
Thanks
Re: How to Make an array of objects in visual c++ 2010
Quote:
Originally Posted by
desoky725
I need to create an array of objects to hold labels in visual c++ 2010,
i tried:
Object^ *labelArray;
labelArray=new Object^ [15];
Wrong forum.
That code is Managed C++, not traditional C++. There is a managed C++ forum, and you should post your question there.
Regards,
Paul McKenzie
Re: How to Make an array of objects in visual c++ 2010
Re: How to Make an array of objects in visual c++ 2010
array<System::Windows::Forms::Label^,1>^ thelabels=gcnew array<System::Windows::Forms::Label^,1>(5);
creates an array of 5 labels.