Easy question: Keep creating objects

This is a discussion on Easy question: Keep creating objects within the C++ Programming forums, part of the General Programming Boards category; I named the start of the topic with "Easy question" because this sould be answered by only 1 or 2 ...

Easy question: Keep creating objects

I named the start of the topic with "Easy question" because this sould be answered by only 1 or 2 members, so that you could concentrate on other more important problems.

So, the user enters some numbers, which will be the elements of a vector from a class. I want that whenever the user finishes entering them (by pressing Enter), a new object to be created. So if I am entering:

1 3 4 4 21 3
1 2 -1 88 9 23
42 9 8 4

there should be 3 objects created with those numbers. How can I dynamically create objects and still be able to access them after?

I am afraid I am unable to put this in an understandable way.. I will give some examples here.
When you declare a CBox object, for example, you write:
CBox abox; or CBox *abox = new CBox;
But as you see, I have declared names for them.

When I enter 1 2 3 4 56 7, a CBox object has to be created. When I enter other series of numbers, another one has to be created. And so on. I cannot refer to those object..

I could create a vector of CBox classes.. and whenever a new series of numbers is entered, to resize the vector so that it could contain as many objects as entered.. but if I declare it as static, then I could not make it have another dimension.. and if I make it dynamically and then readjust its dimension, would not I lose the data so far?

I am making a little project by myself, just to practice my skills, but still, I am a memory-saving paranoic one. And I want to become more skilled in dynamically allocation as well.

I could create a vector of CBox classes.. and whenever a new series of numbers is entered, to resize the vector so that it could contain as many objects as entered.. but if I declare it as static, then I could not make it have another dimension.. and if I make it dynamically and then readjust its dimension, would not I lose the data so far?

As you stated, each object as a vector. This does not conflict with the idea of having a vector of these objects:

I named the start of the topic with "Easy question" because this sould be answered by only 1 or 2 members,

I made the vector of boxes statically in the end. I am afraid I would like a complete representation of that >> overloading, please.

I suggest you put forth some effort and show some code. Laserlight has been gracious enough to show you code, more than I would have given your original vague post, so do some research on your own and figure it out.