fork download
  1. #include <iostream>
  2.  
  3. class foo
  4. {
  5. public:
  6. foo() { }
  7. foo(std::string secret) : secret(secret) { }
  8. void steal_secret(const foo& other) { secret = other.secret; }
  9. std::string get_secret() { return secret; }
  10. private:
  11. std::string secret;
  12. };
  13.  
  14. int main() {
  15. foo f1("don't tell anybody this...");
  16. foo f2;
  17. f2.steal_secret(f1);
  18. std::cout << f2.get_secret() << std::endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
don't tell anybody this...