Changing From Static Memory Use to Dynamic

closed account (365X92yv)
I've got a piece of code. The first is an item class. Its got 3 data variables, item id, price, and name of the item. Then I have a container class used to hold my item objects that I create. I use an array that is created using static memory when I construct a container object. What I'd like to do is change it from allotting all that memory for an unusually large and probably mostly unused objects and use dynamic memory. I'm having a hard time creating the pointer and doing all that jazz required when you use pointers. Could someone give me a real rough pseudocode breakdown of how you would use pointers to create an array of objects and handle adding them to the container and so on. I'd greatly oblige anyone for this.
Last edited on
looks like you want vectors:
http://www.cplusplus.com/reference/stl/vector/

that's the dynamic version of an array. pointers are not required
Topic archived. No new replies allowed.