C (207/414)

From:Alexander Niven-Jenkins
Date:11 Jun 2000 at 07:45:33
Subject:Re: testing function pointers...

Hiya Colin,

On 11-Jun-00, you wrote:

>> This is actually a pointer to a class member function.
>> At the moment it is run as:
>>
>> ( this->*functionptr )();
>>

> No, just "this->functionptr" is the pointer,
> "this->functionptr();" runs it.....

> Add the braces to cause execution of the pointer.
> Arguments can be place in the braces if you want.

I thought this but:

if( this->functionptr )
{
( this->*functionptr )()
}

Causes StormC to chuck up an error: Condition expected.

What I didn't relalise is that you have to do:

if( this->functionptr != NULL )

Thanks!

Kind regards...

Alex



Cremlin Software - http://www.cremlinsoftware.org
Founder, lead programmer - ghandi@cremlinsoftware.org
Production, programmer - anj@cremlinsoftware.org

------------------------------------------------------------------------
Go to Expedia.com to win airfare to Vegas for you and 20 friends,
$15,000 and a suite at Bellagio for New Year's. Or win 2 roundtrip
tickets anywhere in the U.S. given away daily. Click here for a chance win.
http://click.egroups.com/1/5295/1/_/451227/_/960706015/
------------------------------------------------------------------------