A
Allan Rydberg
hi
i have a series of pointer to different classes, such
as in:
class_a *cla;
cla = new class_a;
class_b *clb;
clb = new class_b;
class_c *clc;
clc = new class_c;
class_d *cld;
cld = new class_d;
for different reasons, i'd like to build an array of
pointers from the adresses of the classes, so i can
later call them from the array, using it's index. so
try something like this:
??pointer?? myClaArr[MAXCLASSES];
myClaArr[0] = cla;
myClaArr[1] = clb;
myClaArr[2] = clc;
myClaArr[3] = cld;
as i said, i'd like to be able to not only use the
functions directly as in clb->update(); but also the
call through the adresses in the array:
int active = 1;
myClaArr[active]->update();
how is this written correctly? i'm somehow tangled up with
the array and the adresses.
thanks a lot...
i have a series of pointer to different classes, such
as in:
class_a *cla;
cla = new class_a;
class_b *clb;
clb = new class_b;
class_c *clc;
clc = new class_c;
class_d *cld;
cld = new class_d;
for different reasons, i'd like to build an array of
pointers from the adresses of the classes, so i can
later call them from the array, using it's index. so
try something like this:
??pointer?? myClaArr[MAXCLASSES];
myClaArr[0] = cla;
myClaArr[1] = clb;
myClaArr[2] = clc;
myClaArr[3] = cld;
as i said, i'd like to be able to not only use the
functions directly as in clb->update(); but also the
call through the adresses in the array:
int active = 1;
myClaArr[active]->update();
how is this written correctly? i'm somehow tangled up with
the array and the adresses.
thanks a lot...