fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. class abs
  6. {
  7. int a,b;
  8.  
  9. public:
  10. void unregister(){
  11. a = 0;
  12. b = 0;
  13. }
  14. void erase(){
  15. a = 2;
  16. b = 0;
  17. }
  18. abs(int c,int d);
  19. };
  20. abs::abs(int c,int d){
  21. a = c;
  22. b = d;
  23. }
  24. int main () {
  25. abs obj(4, 2);
  26.  
  27. obj->unregister();
  28. obj.erase();
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:25:9: error: expected ‘;’ before ‘obj’
     abs obj(4, 2);
         ^
prog.cpp:25:18: error: statement cannot resolve address of overloaded function
     abs obj(4, 2);
                  ^
prog.cpp:27:5: error: ‘obj’ was not declared in this scope
     obj->unregister();
     ^
stdout
Standard output is empty