Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Feb 9th, 2008, 12:11 PM   #1
Lakrids
Newbie
 
Join Date: Dec 2007
Posts: 28
Rep Power: 0 Lakrids is on a distinguished road
Pointer to member function

Hello,

There is a quite problematic issue I would like to have solved.

Consider an event handling function for a button. This function takes, among it's arguments, a pointer to a function, which it will execute if the button is pressed. Let's say I have a number of objects of class C, and I would like to do an operation on one of them if the button is pressed. I cannot pass "&object.operation" as a parameter to the button handling function, because the c++ standard doesn't allow that. Instead, I have to pass "&C::action". But passing this will not modify the one object I want to have modified when the user clicks on the button.

Is there a way to pass a function pointer towards the method of THE object I want to modify?

Thank you
Lakrids is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Incompatible pointer type (double pointer in a function) Gabriel Margarido C 16 Nov 23rd, 2007 3:04 AM
Get member function address Klarre C++ 3 Mar 28th, 2007 6:34 AM
Function pointer to a member function Jimbo C++ 3 May 12th, 2006 4:53 PM
Need help writing a member function Rawr101 C++ 3 Apr 11th, 2006 3:18 AM
function pointer raom C 9 Nov 18th, 2005 2:42 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC