Skip to main content
GameDev.net gamedev.net
🔒 Locked

Dynamic class pointer arrays?

Started by WhiteHouse Aug 22, 1999 at 7:37 PM 5 replies 1.7k views
Original Post
WhiteHouse
WhiteHouse
Simple question, hard answer... I just need help with how to initialize and use them in my game.

------------------
----------------------
Kim Forsberg
WorldScape Productions
----------------------

Syntax
Syntax
class llave {
public:
char stuff;

private:
int stuff2;
};

llave *ptr;

void main() {

ptr = new llave[number_here];

ptr[x].stuff = 'C';
}

------------------
E-mail with questions, comments, and retorts.

-Lucas
WhiteHouse
WhiteHouse
Thanks for the answer but unfortunatley i already know how to do that. What i need to know is how to create an dynamic pointer array that can grow and shrink in size in runtime.
Sixpack
Sixpack
Whitehouse:

How about using a linked list with whatever data members you need. To use it like an array, overload the [] operator.

Six

WhiteHouse
WhiteHouse
Do you perhaps know where I might find a tutorial on the subject of linked lists?
Sixpack
Sixpack
Try searching for it on yahoo or another search engine. It is a basic concept, so you should be able to find plenty of information.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.