|
-
August 1st, 2010, 03:23 AM
#1
Function Pointer & _closure
The trouble I'm facing is when I assign a function pointer to another.
Eg:
Code:
class foo
{
public:
bool (*myFunc)();
};
class Main
{
public:
void Procedure();
bool someFunc();
};
bool Main::someFunc ()
{
.
.
}
void Main::Procedure()
{
foo Obj;
Obj.myFunc = &someFunc; //Error
}
On assigning I get the error:
Cannot convert bool(*(_closure)())() to bool(*)(), but I don't know how to fix it. I know that it has something to do with the class owning the function & the function not being accessible without the class object, but how to fix it?
P.S. If the function is a global, then Obj.myFunc = &someGlobalFunc; works out fine
Any help is greatly appreciated.
Regards,
Nisheeth Barthwal
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|