Hi Guys,
I need some help in accessing elements from a list. I am using Visual Studio 2008 (c++).
Here's my code:
using namespace System::Collections::Generic;
public ref class Cord
{
public: int numCord;
public: int x, y, z;
};
public ref class Poly
{
public: Cord c1, c2, c3;
};
//Declare the lists
List<Cord^>^ cordList = gcnew List<Cord^>();
List<Ploy^>^ polyList = gcnew List<Poly^>();
//Add cords to the list
for(int i =0; i < 12; i++)
{
Cord^ newCord = gcnew Cord();
newCord->x = i+1;
newCord->y = i+2;
newCord->z = i+3;
newCord->numCord = i;
cordList->Add(newCord)
}
//Add polys to the list
for(int i = 0; i < 3; i++)
{
Poly^ newPoly = gcnew Poly();
newPoly->c1 = cordList[i];
newPoly->c2 = cordList[i+1];
newPoly->c3 = cordList[i+2];
polyList->Add(newPoly);
}
now every thing upto adding the cords into cordList works fine. But when I try to do newPoly->c1 = cordList; etc.... and try to compile I get the error
error C2582: 'operator =' function is unavailable in 'Cord'
I have researched this error and looked at the msdn help but couldn't find a solution for it.
I have no idea why this is not working. c1,c2,c3 are of type Cord and cordList contains Cords. I am not sure if I am using the Cord class properly to declare the Poly class.
Any help would be appreciated as I am totally stumped.