B
bor_kev
Hi,
I'm using Visual C++ .NET 2003 and I want to use the ArrayList class
in order to put managed classes in it.
For instance , i wrote :
(I created an empty .NET project)
#using namespace System::Collections;
__gc class point
{
protected :
int x; inty;
public :
point( int valx, int valy)
{
x=valx;
y=valy;
}
void getx{ return x;}
void gety {return y;}
// no destructor since it's a managed class
};
int main()
{
point pt1(5,2);
ArrayList * pal = new ArrayList(10);
pal->Add(pt1);
return 0;
}
The compiler says that it cannot convert this point class into
Object*.
Then i tried to inherate point from the Object class...in vain.
I also tried pal->Add(__box(pt1));...in vain.
My question is : What should I do to store managed classes into the
ArrayList and work with them?
Sincerely
bor_kev
Posted at: http://www.groupsrv.com
I'm using Visual C++ .NET 2003 and I want to use the ArrayList class
in order to put managed classes in it.
For instance , i wrote :
(I created an empty .NET project)
#using namespace System::Collections;
__gc class point
{
protected :
int x; inty;
public :
point( int valx, int valy)
{
x=valx;
y=valy;
}
void getx{ return x;}
void gety {return y;}
// no destructor since it's a managed class
};
int main()
{
point pt1(5,2);
ArrayList * pal = new ArrayList(10);
pal->Add(pt1);
return 0;
}
The compiler says that it cannot convert this point class into
Object*.
Then i tried to inherate point from the Object class...in vain.
I also tried pal->Add(__box(pt1));...in vain.
My question is : What should I do to store managed classes into the
ArrayList and work with them?
Sincerely
bor_kev
Posted at: http://www.groupsrv.com