Array of pointers to objects

I have to initialize an object of class Array, which private element is array of pointers to objects of class Message. I can't use <vector> or linked lists. But the thing is I don't know the size of array, or how many objects of class Message do I have.(suppose there is more than 1000)
So how can I do it? I hope I was clear enough. Please give me some suggestions.:)




Last edited on
Dynamically allocate the array.
Thanks, but how do I put all the Message Objects into one Array object?
Last edited on
1
2
3
4
Message* Array = new Message[size];
Message[0] = some_message;
Message[1] = some_other_message;
// ... 

Is this what you are after?
I've meant something like this:

1
2
3
4
5
6
class Array {
Message** el; // or Message* el [size]...but I don't know the value of "size"
 
public:
//...
}


And the problem is how to make

1
2
3
4
**el = the_first_message;
*(*el+1) = the_second_message;
*(*el+2) = the_third_message;
//.. 


Thanks
Last edited on
Topic archived. No new replies allowed.