By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,911 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,911 IT Pros & Developers. It's quick & easy.

Store a static member functions

P: n/a
I tried to store a static member function pointer to some function
pointer... just like this..

class CSomeClass
{
public :
static CSomeClass *Create()
{
return NULL;
};
};

typedef CSomeClass *(CSomeClass::* TmpFunc)();

TmpFunc testFunc = &CSomeClass::Create;

But it's not working because of the static constraint...
After I delete a "static" constraint, It's working well...

Thanks in advance... :)

Aug 5 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

JaeHyun, Roh wrote:
I tried to store a static member function pointer to some function
pointer... just like this..

class CSomeClass
{
public :
static CSomeClass *Create()
{
return NULL;
};
};

typedef CSomeClass *(CSomeClass::* TmpFunc)();

TmpFunc testFunc = &CSomeClass::Create;
typedef CSomeClass*(*TmpFunc)();

But it's not working because of the static constraint...
After I delete a "static" constraint, It's working well...

Thanks in advance... :)


regards, Stephan

Aug 5 '05 #2

P: n/a
Ian
JaeHyun, Roh wrote:
I tried to store a static member function pointer to some function
pointer... just like this..

class CSomeClass
{
public :
static CSomeClass *Create()
{
return NULL;
};
};

typedef CSomeClass *(CSomeClass::* TmpFunc)();

TmpFunc testFunc = &CSomeClass::Create;

But it's not working because of the static constraint...
After I delete a "static" constraint, It's working well...

A static member isn't the same as a regular member function, there is no
hidden this parameter for starters.

Your typedef is for a member, a static member will work with a regular
function pointer.

Ian.
Aug 5 '05 #3

P: n/a
Thanks :)

Aug 5 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.