fork download
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. private:
  6. A() : a(0) {}
  7. A(const A& o){a=o.a;}
  8.  
  9. public:
  10. A(A&& a) : a(a.a) { }
  11.  
  12. static A Create() { return A(); }
  13. int a;
  14. };
  15.  
  16. int main()
  17. {
  18. A a = A::Create();
  19. //A b = a; // compile error!
  20. std::cout << a.a << std::endl;
  21. }
  22.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0