Click here to Skip to main content
15,917,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I check a folder to see if there is a specific file exist or not? Pin
RadioShark23-Mar-04 6:19
RadioShark23-Mar-04 6:19 
GeneralRe: How can I check a folder to see if there is a specific file exist or not? Pin
StarMeteor23-Mar-04 7:25
StarMeteor23-Mar-04 7:25 
GeneralRe: How can I check a folder to see if there is a specific file exist or not? Pin
David Crow23-Mar-04 8:10
David Crow23-Mar-04 8:10 
GeneralRe: How can I check a folder to see if there is a specific file exist or not? Pin
StarMeteor23-Mar-04 8:18
StarMeteor23-Mar-04 8:18 
GeneralRe: How can I check a folder to see if there is a specific file exist or not? Pin
David Crow23-Mar-04 8:23
David Crow23-Mar-04 8:23 
GeneralRe: How can I check a folder to see if there is a specific file exist or not? Pin
StarMeteor23-Mar-04 18:36
StarMeteor23-Mar-04 18:36 
AnswerRe: How can I check a folder to see if there is a specific file exist or not? Pin
David Crow23-Mar-04 6:30
David Crow23-Mar-04 6:30 
GeneralC++ and serialization Pin
_psh_23-Mar-04 5:42
_psh_23-Mar-04 5:42 
Hi all!

I have a base class, CFeature, from which other classes are derived such as CFeatureLine for example. CFeature has a virtual operator, void draw(), which the derived classes always override.

Creating an instance of the derived class, CFeatureLine *pX=new CFeatureLine(...), then serializing it works fine - no problem.

However, in order to de-serialize I use the following code:

CFeature *pFeature; // i use CFeature so that any derived class may be loaded

ar >> pFeature;

But now whenever the draw function of pFeature is called, the compiler directs control to the base class draw function, and not the derived class. This might seem logical, but it appears that MFC's serialization doesn't instantiate a derived class, and instead instantiates the base class, even though the serialization mechanism is supposed to instantiate the class it was saved as.

One way round this is to store a feature type along with the feature data in order to instantiate the appropriate class upon loading, but this is very ugly, and non-modular.

Do you know of a way to solve this? Any help would be great.

Paul.

GeneralRe: C++ and serialization Pin
Robert A. T. Káldy23-Mar-04 10:30
Robert A. T. Káldy23-Mar-04 10:30 
GeneralRe: C++ and serialization Pin
_psh_23-Mar-04 21:48
_psh_23-Mar-04 21:48 
GeneralRe: C++ and serialization Pin
Ravi Bhavnani23-Mar-04 11:05
professionalRavi Bhavnani23-Mar-04 11:05 
GeneralRe: C++ and serialization Pin
_psh_23-Mar-04 23:10
_psh_23-Mar-04 23:10 
GeneralRe: C++ and serialization Pin
Ravi Bhavnani24-Mar-04 3:43
professionalRavi Bhavnani24-Mar-04 3:43 
GeneralRe: C++ and serialization Pin
_psh_24-Mar-04 3:53
_psh_24-Mar-04 3:53 
GeneralMixing C++ and C code - HELP Pin
Member 62566623-Mar-04 5:15
Member 62566623-Mar-04 5:15 
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 5:20
Member 62566623-Mar-04 5:20 
GeneralRe: Mixing C++ and C code - HELP Pin
Maximilien23-Mar-04 5:44
Maximilien23-Mar-04 5:44 
GeneralRe: Mixing C++ and C code - HELP Pin
Pedro Ruiz23-Mar-04 7:30
Pedro Ruiz23-Mar-04 7:30 
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 7:36
Member 62566623-Mar-04 7:36 
GeneralRe: Mixing C++ and C code - HELP Pin
Pedro Ruiz23-Mar-04 7:48
Pedro Ruiz23-Mar-04 7:48 
GeneralRe: Mixing C++ and C code - HELP Pin
Member 62566623-Mar-04 7:35
Member 62566623-Mar-04 7:35 
GeneralRe: Mixing C++ and C code - HELP Pin
John R. Shaw23-Mar-04 11:04
John R. Shaw23-Mar-04 11:04 
Generaldll not terminating correctly Pin
BlackDice23-Mar-04 5:10
BlackDice23-Mar-04 5:10 
GeneralRe: dll not terminating correctly Pin
Blake Miller24-Mar-04 5:54
Blake Miller24-Mar-04 5:54 
GeneralLoad an image Pin
rrrado23-Mar-04 5:09
rrrado23-Mar-04 5:09 

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.