fork download
  1. class Type
  2. {
  3. int i = 0;
  4. public:
  5. Type(const Type&) = delete;
  6. Type& operator=(const Type&) = delete;
  7. public:
  8. Type(){}
  9. void modify() { ++i; }
  10. };
  11.  
  12.  
  13. int main(int argc, const char * argv[])
  14. {
  15. Type a;
  16. Type b(a);
  17. Type c;
  18. c = a;
  19. }
  20.  
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main(int, const char**)’:
prog.cpp:16:13: error: use of deleted function ‘Type::Type(const Type&)’
     Type b(a);
             ^
prog.cpp:5:5: note: declared here
     Type(const Type&)            = delete;
     ^~~~
prog.cpp:18:9: error: use of deleted function ‘Type& Type::operator=(const Type&)’
     c = a;
         ^
prog.cpp:6:11: note: declared here
     Type& operator=(const Type&) = delete;
           ^~~~~~~~
stdout
Standard output is empty