Anonymous functions

P

Pelle Beckman

Does C++ in some way support anonymous functions?

Say I have a callback function that I register
with SetCallback() (this perticular example
is from my attempts at messages, signals, events, etc
in a GUI for a game)

Would something in this way be possible:
(I know Java can do it...)

SetCallback (new function() = {
my_var++;
std::cout << "Hello!" << std::endl;
});


Thanks!

-- Pelle
 
V

Victor Bazarov

Pelle said:
Does C++ in some way support anonymous functions?
No.

Say I have a callback function that I register
with SetCallback() (this perticular example
is from my attempts at messages, signals, events, etc
in a GUI for a game)

Would something in this way be possible:
(I know Java can do it...)

SetCallback (new function() = {
my_var++;
std::cout << "Hello!" << std::endl;
});

No.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top