fork download
  1. #include <iostream>
  2.  
  3. class Rofl {
  4. public:
  5. Rofl(int a, float b) : a(a), b(b) {}
  6. operator float() const { return b; }
  7.  
  8. private:
  9. int a;
  10. float b;
  11. };
  12.  
  13. int main() {
  14. Rofl r(5, 2.0f);
  15. float hello = r;
  16. std::cout << hello << "\n";
  17. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
2