I think you mistyped a semicolon here, but I'm pretty sure it's a copy/paste mistake. This is followed by a "void", which explains the error message (C++ compiler errors generally make no sense if you made a typo, so you have to look through to try and find it), but I doubt this is the source of the error, could you post the revised code if this is so?
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
I think you mistyped a semicolon here, but I'm pretty sure it's a copy/paste mistake. This is followed by a "void", which explains the error message (C++ compiler errors generally make no sense if you made a typo, so you have to look through to try and find it), but I doubt this is the source of the error, could you post the revised code if this is so?
[/quote]
"Button button_file," was a copy/paste mistake . But if you want i can give you code that is needed (some of header file, some of main that is about button), or a full code for a further investigation.
You cannot assign to a function. In your current code, you would have to create a concrete implementation of Button::func.
If you have a newish compiler you can handle this using std::function. If you are using an older compiler and cannot upgrade, boost::function is an option. You could also fall back to function pointers for simple functions, and a pure virtual interface class for more complex scenarios.
You have declared a function. C++ requires this function to have a single definition.
You appear to want to design a callback system, where you can given different Buttons different functions to call when they are clicked. C++ doesn't have "first class" support for this at the language level, but it can be simulated using the approaches I've outlined.