I have some code which is effectively this:
class dummie_type
{
public:
int a;
void do_stuff()
{
// blah
}
};
class dummie_type dummie[10];
void main()
{
subroutine();
}
void subroutine()
{
dummie[3].a = 27; // etc...
dummie[5].do_stuff();
}
Note that the array of classes is global, and I need it to remain so (its a long story). I need to change this code so that the array of classes is of variable length. I know that this will involve making a global pointer, and then setting that to point to a block of memory that gets malloc'ed or new'ed in main and I know that I will have to change the "." characters to "->" but other than that I keep failing to produce something that my compiler will accept. I'm particularly uncertain about the declaration of a global pointer to an array of classes.
Edit: Sorry I should have said earlier, the array size will be calculated once near the start of main() and will remain unchanged from then on.