Click here to Skip to main content
15,886,067 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDestructor Pin
Gjm18-Jul-09 3:17
Gjm18-Jul-09 3:17 
AnswerRe: Destructor Pin
Stuart Dootson18-Jul-09 3:29
professionalStuart Dootson18-Jul-09 3:29 
AnswerRe: Destructor Pin
Bram van Kampen18-Jul-09 15:22
Bram van Kampen18-Jul-09 15:22 
AnswerRe: Destructor Pin
Iain Clarke, Warrior Programmer19-Jul-09 8:16
Iain Clarke, Warrior Programmer19-Jul-09 8:16 
GeneralUninstallation of Visual C++ 8.0 ATL (x86) WinSXS MSM Pin
VictorSotnikov18-Jul-09 2:36
VictorSotnikov18-Jul-09 2:36 
QuestionCreating new object from type_info (typeid) Pin
Tomas(cz)18-Jul-09 2:13
Tomas(cz)18-Jul-09 2:13 
AnswerRe: Creating new object from type_info (typeid) Pin
Stuart Dootson18-Jul-09 2:55
professionalStuart Dootson18-Jul-09 2:55 
GeneralRe: Creating new object from type_info (typeid) Pin
Tomas(cz)18-Jul-09 5:44
Tomas(cz)18-Jul-09 5:44 
Thank you for your reply, I tried to implement it to my code, but I am probably missing something.
Here is a piece of my code:

class SerializationMap
{
public:
	typedef Base_Object* objectPtr;
	static std::map <int,objectPtr (*)()> map; // don't know why it doesn't show <> - it is declared the same way like in the previous post
};

template<class OBJECT_TYPE>;
Base_Object* CreateObject()
{
	return new OBJECT_TYPE();
}

#define REGISTER_CLASS(ID,TYPE) SerializationMap::map.insert(std::make_pair(ID, &CreateObject<TYPE>));

base_object class

#include "SerializationMap.h"

class Base_Object
{
public:
        REGISTER_CLASS(1,Base_Object)
	Base_Object(void);
	~Base_Object(void);
	Base_Object(const Base_Object& obj);
	void operator =(const Base_Object& obj);
	int archive_version;

private:
	int serializationClassId;
};


but when I try to compile I get these errors:
error C2143: syntax error: missing ';' before '.'
error C2238: unexpected token(s) preceding ';'
error C2602: 'SerializationMap::map' is not a member of a base class of 'Base_Object'
error C3210: 'SerializationMap' : access declaration can only be applied to a base class member.

What am I doing wrong?
Thanks
GeneralRe: Creating new object from type_info (typeid) Pin
Stuart Dootson18-Jul-09 7:24
professionalStuart Dootson18-Jul-09 7:24 
AnswerRe: Creating new object from type_info (typeid) Pin
Bram van Kampen18-Jul-09 15:35
Bram van Kampen18-Jul-09 15:35 
QuestionHow to save a bitmap in Visual c++ (mfc)? Pin
Sakthi.Gs :-)18-Jul-09 0:43
Sakthi.Gs :-)18-Jul-09 0:43 
AnswerRe: How to save a bitmap in Visual c++ (mfc)? Pin
Iain Clarke, Warrior Programmer18-Jul-09 1:05
Iain Clarke, Warrior Programmer18-Jul-09 1:05 
AnswerRe: How to save a bitmap in Visual c++ (mfc)? Pin
ravidborse20-Jul-09 3:17
ravidborse20-Jul-09 3:17 
QuestionCRECT height Pin
kumar sanghvi18-Jul-09 0:03
kumar sanghvi18-Jul-09 0:03 
AnswerRe: CRECT height Pin
Naveen18-Jul-09 0:11
Naveen18-Jul-09 0:11 
GeneralRe: CRECT height Pin
kumar sanghvi18-Jul-09 0:40
kumar sanghvi18-Jul-09 0:40 
GeneralRe: CRECT height Pin
Iain Clarke, Warrior Programmer18-Jul-09 1:02
Iain Clarke, Warrior Programmer18-Jul-09 1:02 
Questiondoc file processing Pin
alashara17-Jul-09 23:47
alashara17-Jul-09 23:47 
AnswerRe: doc file processing Pin
Iain Clarke, Warrior Programmer18-Jul-09 1:10
Iain Clarke, Warrior Programmer18-Jul-09 1:10 
GeneralRe: doc file processing Pin
alashara18-Jul-09 1:46
alashara18-Jul-09 1:46 
GeneralRe: doc file processing Pin
Bram van Kampen18-Jul-09 15:46
Bram van Kampen18-Jul-09 15:46 
AnswerRe: doc file processing Pin
Alain Rist18-Jul-09 22:50
Alain Rist18-Jul-09 22:50 
AnswerRe: doc file processing Pin
Randor 19-Jul-09 13:45
professional Randor 19-Jul-09 13:45 
QuestionConversion from char * to LPWSTR Pin
Pardhu_M17-Jul-09 22:27
Pardhu_M17-Jul-09 22:27 
AnswerRe: Conversion from char * to LPWSTR Pin
Naveen17-Jul-09 23:05
Naveen17-Jul-09 23:05 

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.