• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Compiler Error (Member Function Pointers)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler Error (Member Function Pointers)


  • Subject: Re: Compiler Error (Member Function Pointers)
  • From: Randy Croucher <email@hidden>
  • Date: Fri, 7 Nov 2003 08:47:49 -0800

> I'm not 100% sure, but doesn't your passed-along function have to be a
> static function in order to allow it for being passed as a parameter ?
>
> here :
>
> class DerivedObject : public BaseObject
> {
> public:
>     static const MyEntry m_entries[];
>     void DoSomething();    // <<<<<-------------------- static ?
> };

No, because you can actually give the function "this" by calling it
like this:

void CallFunc( BaseObject *obj, MY_FUNC pfn )
{
    (obj->*pfn)();
}

or...

void DerivedObject::CallFunc( MY_FUNC pfn )
{
    (this->*pfn)();
}
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Compiler Error (Member Function Pointers) (From: Randy Croucher <email@hidden>)

  • Prev by Date: Inclue paths, was: Boost and frameworks
  • Next by Date: re: Public Headers in Xcode?
  • Previous by thread: Compiler Error (Member Function Pointers)
  • Next by thread: Re: Public Headers in Xcode?
  • Index(es):
    • Date
    • Thread