I'm making a class Button;
which constructor is getting a pointer to function, to execute on click. Is there any easy way to define the function I want to give it? Like without name.. for example when I'm creating the button, just to open the scopes and write the function without special name. Because I have to create many buttons and I don't want to write a function for each button and with it's own name..(names collision etc)
like for example this java code:
someObject.addMyListener(new MyListener() {
public void processEvent(MyEvent e) {
// How do you access the variable outerClassField?
}
});
maybe I'm wrong but we writing the MyListener
function ON PLACE without any special name or pre define.
Is it possible in c++?