Click here to Skip to main content
15,867,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: a question that did not get any true answer :(( Pin
Stephen Hewitt25-Feb-06 2:37
Stephen Hewitt25-Feb-06 2:37 
GeneralRe: a question that did not get any true answer :(( Pin
Hamed Musavi25-Feb-06 20:15
Hamed Musavi25-Feb-06 20:15 
QuestionRe: a question that did not get any true answer :(( Pin
Hamed Musavi25-Feb-06 1:09
Hamed Musavi25-Feb-06 1:09 
AnswerRe: a question that did not get any true answer :(( Pin
Stephen Hewitt25-Feb-06 1:12
Stephen Hewitt25-Feb-06 1:12 
GeneralRe: a question that did not get any true answer :(( Pin
Hamed Musavi25-Feb-06 1:20
Hamed Musavi25-Feb-06 1:20 
GeneralRe: a question that did not get any true answer :(( Pin
toxcct25-Feb-06 9:00
toxcct25-Feb-06 9:00 
GeneralRe: a question that did not get any true answer :(( Pin
Hamed Musavi25-Feb-06 20:24
Hamed Musavi25-Feb-06 20:24 
GeneralRe: a question that did not get any true answer :(( Pin
BadKarma25-Feb-06 23:11
BadKarma25-Feb-06 23:11 
Hi,

to answer your question, both languages have a mechanism to do wath you wanted.
In C# its called reflection. You can ask a type(class) which members it has at runtime.

Hamed Mosavi wrote:
Furthermore, why giving information about a data type at compile time is not suitable for C/C++ ?


C++ doesn't have this for a few good reassons.
a. Its slow
b. It use more memory
c. hence there is no simple memory to a plain 'c' structure translation

Altough c++ doensn't have this. You can create it if you really need/want to.

But there is another approach you might consider. I guess you want to save data from
the memory to a file or vice versa. This is called persistence, or like MFC calls it
Serialisation. This method allows just the thing you want.

You can use there framework (CFile, CArcive) to implement the serialisation you need.
Or you can create your own using this concept. It differs from you concept to a more
OO solutiuon.

Your solution needed one class who knows everything about all classes (this is alsoo
nessecary in c#). When adding a new class you never know if there are restriction on
what to save to file (for instance, void pointer list, function pointers, temporary members)

In the more OO solution, everey class knows how to save/load itself too an archive or
other class object that handles binary data to be saved or loaded to file and memory.
In the second solution, when adding a new class you only need to implement the
save/load function for that class and everything works without problems.



codito ergo sum
GeneralRe: a question that did not get any true answer :(( Pin
Hamed Musavi26-Feb-06 2:38
Hamed Musavi26-Feb-06 2:38 
NewsI thought about a soloution. Pin
Hamed Musavi25-Feb-06 1:44
Hamed Musavi25-Feb-06 1:44 
QuestionColor picker extension Pin
Hans Dietrich25-Feb-06 0:05
mentorHans Dietrich25-Feb-06 0:05 
AnswerRe: Color picker extension Pin
Blake Miller27-Feb-06 6:05
Blake Miller27-Feb-06 6:05 
QuestionSocket Communication Pin
kk.tvm24-Feb-06 21:24
kk.tvm24-Feb-06 21:24 
AnswerRe: Socket Communication Pin
Naveen24-Feb-06 22:19
Naveen24-Feb-06 22:19 
AnswerRe: Socket Communication Pin
Indivara25-Feb-06 1:33
professionalIndivara25-Feb-06 1:33 
AnswerRe: Socket Communication Pin
ThatsAlok26-Feb-06 21:31
ThatsAlok26-Feb-06 21:31 
QuestionDll Registration Problem Pin
Anil_vvs24-Feb-06 19:39
Anil_vvs24-Feb-06 19:39 
AnswerRe: Dll Registration Problem Pin
karle25-Feb-06 8:28
karle25-Feb-06 8:28 
AnswerRe: Dll Registration Problem Pin
Anil_vvs25-Feb-06 20:34
Anil_vvs25-Feb-06 20:34 
QuestionCheckpointing a process Pin
Rane24-Feb-06 17:25
Rane24-Feb-06 17:25 
AnswerRe: Checkpointing a process Pin
Stephen Hewitt24-Feb-06 22:43
Stephen Hewitt24-Feb-06 22:43 
QuestionHow to using DAO connection with password Pin
stny200024-Feb-06 13:16
stny200024-Feb-06 13:16 
AnswerRe: How to using DAO connection with password Pin
Cool Ju24-Feb-06 21:10
Cool Ju24-Feb-06 21:10 
GeneralRe: How to using DAO connection with password Pin
stny200013-Mar-06 19:50
stny200013-Mar-06 19:50 
Questionissue linking Pin
act_x24-Feb-06 11:24
act_x24-Feb-06 11:24 

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.