fork download
  1. struct Point {
  2. double x;
  3. double y;
  4. double z;
  5.  
  6. Point& operator+=(Point const& right) {
  7. x += right.x; y += right.y; z += right.z;
  8. return *this;
  9. }
  10.  
  11. Point& operator*=(double f) {
  12. x *= f; y *= f; z *= f;
  13. return *this;
  14. }
  15. };
  16.  
  17. int main() { Point p = ((Point{1,2,3} *= 2) += Point{4,5,6}); }
Success #stdin #stdout 0s 2824KB
stdin
Standard input is empty
stdout
Standard output is empty