Click here to Skip to main content
15,913,587 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: transferring control between 2 programs? Pin
David Crow14-Jun-07 8:41
David Crow14-Jun-07 8:41 
GeneralRe: transferring control between 2 programs? Pin
IlanTal14-Jun-07 23:47
IlanTal14-Jun-07 23:47 
AnswerRe: transferring control between 2 programs? Pin
DjinnKahn14-Jun-07 5:03
DjinnKahn14-Jun-07 5:03 
GeneralRe: transferring control between 2 programs? Pin
David Crow14-Jun-07 5:39
David Crow14-Jun-07 5:39 
GeneralRe: transferring control between 2 programs? Pin
IlanTal14-Jun-07 8:15
IlanTal14-Jun-07 8:15 
QuestionCreating array/object at runtime. Pin
Sameer_Thakur14-Jun-07 4:07
Sameer_Thakur14-Jun-07 4:07 
AnswerRe: Creating array/object at runtime. Pin
David Crow14-Jun-07 4:47
David Crow14-Jun-07 4:47 
AnswerRe: Creating array/object at runtime. Pin
Mark Salsbery14-Jun-07 7:28
Mark Salsbery14-Jun-07 7:28 
Sameer_Thakur wrote:
how can I create an array/object of same data type at runtime?


AFAIK, there's no way to do this directly in C++.

You can, however, design a system of classes that are capable of creating/cloning themselves at
runtime and/or being created by type.

For an example implementation, check out the source code for MFC's CRuntimeClass and CObject
classes and the DECLARE_DYNAMIC/IMPLEMENT_DYNAMIC macros. This implementation has a common
base class which includes methods for runtime object creation based on a class name.
Because C++ has no built-in way to do this, the CRuntimeClass implements a list that maps
class names to creator functions.

Depending on the source of your source arrays, serialization may be useful as well.

Regardless, at the heart of these solutions is code that creates objects of a specific class,
which is all that C++ allows.

Just my 2-cents,
Mark




"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

Questionwindow caption Pin
Neeraj Sinha14-Jun-07 3:56
Neeraj Sinha14-Jun-07 3:56 
QuestionRe: window caption Pin
Nelek14-Jun-07 19:46
protectorNelek14-Jun-07 19:46 
QuestionGetting Office language settings in MFC Pin
Tarek Jabri14-Jun-07 3:23
Tarek Jabri14-Jun-07 3:23 
QuestionPrinting html displayed in WebBrowser2 Pin
SgLife14-Jun-07 2:21
SgLife14-Jun-07 2:21 
AnswerRe: Printing html displayed in WebBrowser2 Pin
SgLife14-Jun-07 14:42
SgLife14-Jun-07 14:42 
QuestionC++ Exception Pin
T.RATHA KRISHNAN14-Jun-07 2:19
T.RATHA KRISHNAN14-Jun-07 2:19 
AnswerRe: C++ Exception Pin
SandipG 14-Jun-07 2:25
SandipG 14-Jun-07 2:25 
AnswerRe: C++ Exception Pin
prasad_som14-Jun-07 2:51
prasad_som14-Jun-07 2:51 
QuestionRe: C++ Exception Pin
T.RATHA KRISHNAN14-Jun-07 2:54
T.RATHA KRISHNAN14-Jun-07 2:54 
AnswerRe: C++ Exception Pin
prasad_som14-Jun-07 3:02
prasad_som14-Jun-07 3:02 
QuestionRe: C++ Exception Pin
T.RATHA KRISHNAN14-Jun-07 3:09
T.RATHA KRISHNAN14-Jun-07 3:09 
AnswerRe: C++ Exception Pin
Russell'14-Jun-07 4:12
Russell'14-Jun-07 4:12 
QuestionRe: C++ Exception Pin
T.RATHA KRISHNAN15-Jun-07 0:19
T.RATHA KRISHNAN15-Jun-07 0:19 
AnswerRe: C++ Exception Pin
Russell'15-Jun-07 0:52
Russell'15-Jun-07 0:52 
QuestionRe: C++ Exception Pin
T.RATHA KRISHNAN15-Jun-07 1:39
T.RATHA KRISHNAN15-Jun-07 1:39 
AnswerRe: C++ Exception Pin
Russell'15-Jun-07 2:15
Russell'15-Jun-07 2:15 
QuestionRe: C++ Exception Pin
T.RATHA KRISHNAN15-Jun-07 2:50
T.RATHA KRISHNAN15-Jun-07 2:50 

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.