Re: Type of pointer to function?
From: Josh Sebastian (curien_at_cox.net)
Date: 01/21/04
- Next message: Jarmo: "Re: How to connect to dbf files?"
- Previous message: Josh Sebastian: "Re: find nearest/bigger/smaller value in vector with binary_search?"
- In reply to: Karl Heinz Buchegger: "Re: Type of pointer to function?"
- Next in thread: Sam Dutton: "Re: Type of pointer to function?"
- Reply: Sam Dutton: "Re: Type of pointer to function?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Jan 2004 17:35:24 -0500
On Wed, 21 Jan 2004 16:38:36 +0100, Karl Heinz Buchegger wrote:
> Sam Dutton wrote:
>>
>> I want to pass a function as an argument. (I'm using Qt, compiling with
>> Visual Studio .net).
>>
>> The function to be passed looks like this:
>>
>> void MainWindow::finishedProgrammes(QNetworkOperation *op)
>>
>> How should the declaration look? I've tried the following, but it leads to a
>> 2664 error in Visual Studio .net:
>
> Next time please post the entire text of the error message, 2664 dosn't
> mean anything to anybody unless he/she is using VC .net
>
>
>> void getString(const QString&, const QObject*, void
>> (*)(QNetworkOperation*));
>>
>> How should the function look? I've tried the following:
>
> For things like function pointers it's always the best
> to start with a typedef
>
> typedef void (* MainWindow::FinishFnct)( QNetworkOperation *op )
ITYM
typedef void (MainWindow::*FinishFnct)(QNetworkOperation* op);
> Using that you get
>
> vid getString( const QString&, const QObject*, FinishFnct )
To OP:
That is a pointer to member function, which is very different from a
pointer to function. If you aren't familiar with them, I suggest you look
them up in your favorite textbook.
Josh
- Next message: Jarmo: "Re: How to connect to dbf files?"
- Previous message: Josh Sebastian: "Re: find nearest/bigger/smaller value in vector with binary_search?"
- In reply to: Karl Heinz Buchegger: "Re: Type of pointer to function?"
- Next in thread: Sam Dutton: "Re: Type of pointer to function?"
- Reply: Sam Dutton: "Re: Type of pointer to function?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|