Click here to Skip to main content
15,907,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Automatic Copy Pin
CPallini25-Aug-08 3:30
mveCPallini25-Aug-08 3:30 
QuestionTab control for controls Pin
hariakuthota24-Aug-08 23:55
hariakuthota24-Aug-08 23:55 
AnswerRe: Tab control for controls Pin
Jijo.Raj25-Aug-08 0:33
Jijo.Raj25-Aug-08 0:33 
QuestionWriteFile() Pin
john563224-Aug-08 23:52
john563224-Aug-08 23:52 
QuestionRe: WriteFile() Pin
Perspx25-Aug-08 1:12
Perspx25-Aug-08 1:12 
QuestionAcccessing HID device properties from the device manager. Pin
hariakuthota24-Aug-08 23:39
hariakuthota24-Aug-08 23:39 
AnswerRe: Acccessing HID device properties from the device manager. Pin
cmk25-Aug-08 12:32
cmk25-Aug-08 12:32 
Questiondynamic array Pin
Sunday8PM24-Aug-08 23:31
Sunday8PM24-Aug-08 23:31 
Let's say I have a class called MyClass. I want to store objects of this class in a dynamic array and by dynamic I mean the ability to add any number of object one by one, not a predefined number. I have googled it and "dynamic array" appears to mean that you can assign a dynamic length when you create the array but that's not what I'm looking for. I want an array with an unspecified length that I can add any number of objects to.

Would something like this work?

MyClass *MyObjects = new MyClass[];

MyObject[0] = MyObject1
MyObject[1] = MyObject2
MyObject[2] = MyObject3


If I have understood arrays, increasing the number will make it jump to the next place in the memory (8 byte jump forward if the object takes 8 bytes). I'm worried that since I haven't specified the length of the array before, it might write over something else since it isn't expecting the array to use it.

I haven't tested the code, I just came to think of it.

Would the code work? is there another way of doing it? Is it possible at all?

Any help appreciated.
AnswerRe: dynamic array Pin
Naveen24-Aug-08 23:38
Naveen24-Aug-08 23:38 
GeneralRe: dynamic array [modified] Pin
CPallini25-Aug-08 0:04
mveCPallini25-Aug-08 0:04 
GeneralRe: dynamic array Pin
Naveen25-Aug-08 0:09
Naveen25-Aug-08 0:09 
GeneralRe: dynamic array Pin
Jijo.Raj25-Aug-08 0:17
Jijo.Raj25-Aug-08 0:17 
GeneralRe: dynamic array Pin
Naveen25-Aug-08 0:59
Naveen25-Aug-08 0:59 
GeneralRe: dynamic array Pin
CPallini25-Aug-08 0:26
mveCPallini25-Aug-08 0:26 
AnswerRe: dynamic array Pin
Perspx24-Aug-08 23:45
Perspx24-Aug-08 23:45 
AnswerRe: dynamic array Pin
Jijo.Raj24-Aug-08 23:54
Jijo.Raj24-Aug-08 23:54 
GeneralRe: dynamic array Pin
Sunday8PM25-Aug-08 0:12
Sunday8PM25-Aug-08 0:12 
AnswerRe: dynamic array Pin
David Crow25-Aug-08 4:51
David Crow25-Aug-08 4:51 
AnswerRe: dynamic array Pin
erkanina8-Sep-08 10:02
erkanina8-Sep-08 10:02 
QuestionMerging two icons(transparent BitBlt) Pin
haimen24-Aug-08 23:13
haimen24-Aug-08 23:13 
Questioncompling file in the Debug build, but errors in the Release build. advice Pin
ptr_Electron24-Aug-08 23:01
ptr_Electron24-Aug-08 23:01 
AnswerRe: compling file in the Debug build, but errors in the Release build. advice Pin
CPallini24-Aug-08 23:22
mveCPallini24-Aug-08 23:22 
AnswerRe: compling file in the Debug build, but errors in the Release build. advice Pin
toxcct24-Aug-08 23:23
toxcct24-Aug-08 23:23 
GeneralRe: compling file in the Debug build, but errors in the Release build. advice Pin
santhoshv8425-Aug-08 0:19
santhoshv8425-Aug-08 0:19 
GeneralRe: compling file in the Debug build, but errors in the Release build. advice Pin
toxcct25-Aug-08 0:30
toxcct25-Aug-08 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.