fork download
  1. #include <iostream>
  2.  
  3. struct pt
  4. {
  5. double a;
  6. explicit pt(double a) : a(a) {};
  7.  
  8. void operator*=(const pt& x) {
  9. a *= x.a;
  10. }
  11. };
  12.  
  13. int main()
  14. {
  15. pt p(10);
  16.  
  17. p *= 20.0;
  18.  
  19. std::cout << p.a << '\n';
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:17: error: no match for ‘operator*=’ in ‘p *= 2.0e+1’
prog.cpp:8: note: candidates are: void pt::operator*=(const pt&)
stdout

Standard output is empty