Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: bizarre problem with files Pin
lahom25-Jun-08 6:55
lahom25-Jun-08 6:55 
QuestionRe: bizarre problem with files Pin
CPallini25-Jun-08 11:07
mveCPallini25-Jun-08 11:07 
AnswerRe: bizarre problem with files Pin
lahom25-Jun-08 12:25
lahom25-Jun-08 12:25 
GeneralRe: bizarre problem with files Pin
CPallini25-Jun-08 21:00
mveCPallini25-Jun-08 21:00 
AnswerRe: bizarre problem with files Pin
Kwanalouie23-Jun-08 1:47
Kwanalouie23-Jun-08 1:47 
AnswerRe: bizarre problem with files [modified] Pin
Kwanalouie24-Jun-08 0:24
Kwanalouie24-Jun-08 0:24 
Questionthere is a questioin about function pointer and template Pin
CresShadow22-Jun-08 16:18
CresShadow22-Jun-08 16:18 
AnswerRe: there is a questioin about function pointer and template Pin
Saurabh.Garg22-Jun-08 17:31
Saurabh.Garg22-Jun-08 17:31 
Try something like this.

template <typename t> class c
{
public:
	
	typedef t (c::*FuncPtr)();
	
	int f1()
	{
		mFp=&c::f1;
		return 1;
	}
	
	char* f2()
	{
		mFp=&c::f2;
		return "hi";
	}
	
	t recentFunction()
	{
		return (this->*mFp)();
	}
	
private:
	
	FuncPtr mFp;
};


Test it using this.

c<int> c1;
c<char*> c2;


c1.f1();
// c1.f2(); // Invalid.
int x = c1.recentFunction();


//c2.f1(); // Invalid.
c2.f2();
char* ret = c2.recentFunction();


If you want to read more about member function pointer search for delegates. There are numerous articles on this topic on codeproject. One of them is Member Function Pointers and the Fastest Possible C++ Delegates[^].

-Saurabh
QuestionVisual Studio: Where do I put my stuff? Pin
bkelly1322-Jun-08 16:06
bkelly1322-Jun-08 16:06 
AnswerRe: Visual Studio: Where do I put my stuff? Pin
Saurabh.Garg22-Jun-08 17:39
Saurabh.Garg22-Jun-08 17:39 
QuestionIs it safe to call GetPrivateProfileString in Serialize? Pin
followait22-Jun-08 14:04
followait22-Jun-08 14:04 
AnswerRe: Is it safe to call GetPrivateProfileString in Serialize? Pin
led mike22-Jun-08 14:49
led mike22-Jun-08 14:49 
GeneralRe: Is it safe to call GetPrivateProfileString in Serialize? Pin
followait22-Jun-08 15:26
followait22-Jun-08 15:26 
QuestionHow to SHow all files and sub-directories and there all files By usign c++ Only c++ Pin
Pak_Coder22-Jun-08 7:37
Pak_Coder22-Jun-08 7:37 
AnswerRe: How to SHow all files and sub-directories and there all files By usign c++ Only c++ Pin
Robert.C.Cartaino22-Jun-08 7:53
Robert.C.Cartaino22-Jun-08 7:53 
GeneralRe: How to SHow all files and sub-directories and there all files By usign c++ Only c++ Pin
Pak_Coder22-Jun-08 13:31
Pak_Coder22-Jun-08 13:31 
GeneralRe: How to SHow all files and sub-directories and there all files By usign c++ Only c++ Pin
Stephen Hewitt22-Jun-08 15:49
Stephen Hewitt22-Jun-08 15:49 
Questionhow to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
Pak_Coder22-Jun-08 5:30
Pak_Coder22-Jun-08 5:30 
AnswerRe: how to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
Saurabh.Garg22-Jun-08 5:38
Saurabh.Garg22-Jun-08 5:38 
GeneralRe: how to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
Pak_Coder22-Jun-08 5:41
Pak_Coder22-Jun-08 5:41 
GeneralRe: how to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
zafersavas22-Jun-08 6:03
zafersavas22-Jun-08 6:03 
GeneralRe: how to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
Pak_Coder22-Jun-08 6:07
Pak_Coder22-Jun-08 6:07 
GeneralRe: how to resolve this problem fatal error LNK1104: cannot open file 'libboost_filesystem-vc80-mt-gd-1_35.lib' Pin
Saurabh.Garg22-Jun-08 14:25
Saurabh.Garg22-Jun-08 14:25 
QuestionHelp is restoring MS exchange 2003 programmatically? Pin
nasif400322-Jun-08 4:38
nasif400322-Jun-08 4:38 
QuestionWhy the Template Classe can't build in two file (.cpp and .h) Pin
liuxianming200122-Jun-08 2:27
liuxianming200122-Jun-08 2:27 

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.