|
-
February 14th, 2005, 03:35 PM
#1
Problem using a method pointer
Consider the following class:
class Alpha
{
public:
virtual bool Print2(void);
virtual bool Print1(void);
Alpha();
virtual ~Alpha();
bool ( Alpha::*Print)(void);
};
bool Alpha::Print1()
{
printf("Alpha 1\n");
return true;
}
bool Alpha::Print2()
{
printf("Alpha 2\n");
return false;
}
Now the following test code:
Alpha Test1;
Test1.Print = Alpha::Print1;
Test1.Print();
Test1.*Print();
(*Test1.Print)();
None of the above syntax is correct for calling the print method. How do I call it?
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
|