fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Function {
  5. public:
  6. Function() {
  7. cout << "Function created!" << endl;
  8. }
  9. void operator () ()
  10. {
  11. cout << "Function called (Class)" << endl;
  12. }
  13. };
  14.  
  15. void Function() {
  16. cout << "Function called" << endl;
  17. }
  18.  
  19. int main() {
  20. //class Function f;
  21. class Function *function = new class Function;
  22. Function();
  23. (*function)();
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
Function created!
Function called
Function called (Class)