fork download
  1. #include <functional>
  2.  
  3. class Calc {
  4.  
  5. private:
  6.  
  7. std::function <void()> Command_Function;
  8.  
  9. void Naming() {
  10. }
  11.  
  12. public:
  13.  
  14. Calc() {
  15. Command_Function = Naming;
  16. }
  17.  
  18. void operator()() {
  19. }
  20. };
  21.  
  22.  
  23.  
  24. int main() {
  25. Calc calculater;
  26. calculater();
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor ‘Calc::Calc()’:
prog.cpp:15:22: error: invalid use of non-static member function ‘void Calc::Naming()’
   Command_Function = Naming;
                      ^~~~~~
prog.cpp:9:7: note: declared here
  void Naming() {
       ^~~~~~
stdout
Standard output is empty