[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: How do I call pointer-to-member function with gcc 2.8 ?
From: Espen Sand <espen.sand () neo ! no>
Date: 2000-01-05 13:24:51
[Download RAW message or body]
On ons, 05 jan 2000, aleXXX wrote:
>On Mit, 05 Jan 2000, Espen Sand wrote:
>>
>> --
>> Espen Sand
>
>
>Small addition:
>
>class SomeStuff;
>
>typedef void (SomeStuff::FunctionPointer) (SomeArgumentClass * =0);
>
>class SomeStuff
>{
>...
>FunctionPointer currentFunction;
>void f1(SomeArgumentClass *a=0);
>void f2 (SomeArgumentClass *b=0);
>}
>...
>this function is member of SomeStuff:
>
>void SomeStuff::whateverFunction()
>{
>SomeArgumentClass xyz;
>currentFunction=&f1;
>currentFunction(&xyz);
>}
>
>*currentFunction(&xyz);
>doesn't work neither
>
>So what should I do?
1) I have never tried with default arguments so I don't know what problems that
may introduce.
2) I setup the pointer with "printOffset = &CHexBuffer::printDummyOffset;"
In your case currentFunction = &SomeStuff::f1;
3) What do you mean by "doesn't work" ?
4) If you can compile khexedit (cvs or kde 1.1.x version) then you use function
pointers. Have a look in hexbuffer.cc + h to see how it is done.
--
Espen Sand
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic