fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct Test{
  6. operator int() const{
  7. return 5;
  8. }
  9. operator string() const{
  10. return "100500";
  11. }
  12. };
  13.  
  14. int main() {
  15. // your code goes here
  16. Test x;
  17. int a = x;
  18. string b = x;
  19. cout << a<<" "<<b<<endl;
  20. return 0;
  21. }
Success #stdin #stdout 0s 4512KB
stdin
Standard input is empty
stdout
5 100500