delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/10/23:00:17

Message-ID: <352EDA1E.7B0C55AF@teccart.qc.ca>
From: "J-Réginald Louis" <louis DOT jean-reginald AT teccart DOT qc DOT ca>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Dynamic memory allocation
Lines: 20
Date: Sat, 11 Apr 1998 02:46:01 GMT
NNTP-Posting-Host: ppp181.245.mmtl.videotron.net
NNTP-Posting-Date: Fri, 10 Apr 1998 22:46:01 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

My question is not about DJGPP itself, but a general C++ question.
I'm writting a 3D engine. I have a class called 'Scene' holding a list
of object to render.
The list is consisting of an array of pointers to type 'Object'. Like
this:

#define MAX_LIST    10            // example

stuct Scene
{
 Object *ObjList[MAX_LIST];
 int AddObject(Object *obj);                // Add an object to the
object list
 int RemoveObject(Object *Obj);        // Remove the object from the
object list
 // Other data definition and method definition
};

My problem is that the user/programmer can't add more than 10 object's.
I think it's not
"correct" to determine a specific array length.
So, what I'm asking is how can I append and remove objects in the list
dynamicaly?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019