i'm pretty sure i can declare it like this
class Stupid
{
public:
void (*GetFnValue( char* key ))( );
};
but i'm lost at implementation, something like
void (*fn)( )
Stupid::GetFnValue( char* key )
{
return whatev;
}
tanks
class Stupid
{
public:
void (*GetFnValue( char* key ))( );
};
void (*fn)( )
Stupid::GetFnValue( char* key )
{
return whatev;
}
void (*Stupid::GetFnValue( char* key ))()
{
return 0;
}
class Stupid
{
public:
void (*GetFnValue( char* key ))( );
};
class Stupid
{
public:
MyFunctorClass f;
};
class MyFunctor{
public:
MyFunctor(char* key)
{
//do some stuff
}
}
MyFunctorClass fun;
Stupid s;
s.f=fun
//use the function
s.f(argument)
and if You want a function returning a function it would just be sth like this:
MyFunctorClass Stupid::FunRetFun(argtypes arguments)
{
//do something
return SomeInstance of MyFunctorClass;
}
I don't know if thats handy in Your application, but in a few programs that I have created it worked very well and it was much more comfy to use.
Regards
class Stupid
{
public:
void (*GetFnValue( char* key ))( );
};
class Stupid
{
public:
MyFunctorClass FunRetFun(argtypes arguments)
};
class MyFunctor{
public:
MyFunctor(char* key)
{
//do some stuff
}
}
MyFunctorClass Stupid::FunRetFun(argtypes arguments)
{
//do something
return SomeInstance of MyFunctorClass;
}