I am playing with Slick-C classes and have the following question:
What is the most efficient way to add a class instance to an array?
tcClassType MyArray[];
for(i=0;i<SomeCount;i++)
{
MyArray[i] = new class instance() <- what is the correct syntax???
}
This syntax gives an error:
for(i=0;i<SomeCount;i++)
{
MyArray[i] = tcClassType(parm1, parm2,...);
}
I can do this, but is requires an extra deep copy of the instance:
for(i=0;i<SomeCount;i++)
{
tcClassType MyClassInst(parm1,parm2,...);
MyArray[i] = MyClassInst;
}
Is there a better syntax?
Thanks!