B
b83503104
Hi,
class MyClass{
int array_size;
HisClass **hisObject;
};
I want hisObject to point to an array of HisClass objects.
The size of the array is given by array_size.
My question is, if objects of type HisClass must be declared by the
library provided function CreateObject(), and cannot be declared by
using "new", how should I declare hisObject?
If I do this in the constructor, the compiler does not complain, but I
get Segmentation fault:
array_size = 5;
for (int i = 0; i < array_size; i++){
hisObject = CreateObject(...);
}
Thanks in advance!
class MyClass{
int array_size;
HisClass **hisObject;
};
I want hisObject to point to an array of HisClass objects.
The size of the array is given by array_size.
My question is, if objects of type HisClass must be declared by the
library provided function CreateObject(), and cannot be declared by
using "new", how should I declare hisObject?
If I do this in the constructor, the compiler does not complain, but I
get Segmentation fault:
array_size = 5;
for (int i = 0; i < array_size; i++){
hisObject = CreateObject(...);
}
Thanks in advance!