C
Chris
Can you make an array of classes with dynamically allocated members?
For example:
###
class LIST {
public:
char * data;
LIST() {
data = (char *) malloc(10*sizeof(char); }
~LIST() { free(data); } };
LIST lists[52];
###
Is this legal? Also, can I reallocate the memory that was allocated in
the example?
###
lists[14].data = (char *) realloc(lists[14].data, 16*sizeof(char));
###
Thanks for any help!
-Chris
For example:
###
class LIST {
public:
char * data;
LIST() {
data = (char *) malloc(10*sizeof(char); }
~LIST() { free(data); } };
LIST lists[52];
###
Is this legal? Also, can I reallocate the memory that was allocated in
the example?
###
lists[14].data = (char *) realloc(lists[14].data, 16*sizeof(char));
###
Thanks for any help!
-Chris