fork(1) download
  1. #include <iostream>
  2.  
  3. class X
  4. {
  5. public:
  6. X(int x) : m_x(x) {}
  7. void PrintMe() { std::cout << m_x << std::endl; }
  8. private:
  9. int m_x;
  10. };
  11.  
  12. int main()
  13. {
  14. X a = 23;
  15. X b = 5;
  16.  
  17. b.PrintMe(); // 5
  18. b = a;
  19. b.PrintMe(); // 23
  20.  
  21. X c = b;
  22. c.PrintMe(); // 23
  23. }
  24.  
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
5
23
23