fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {
  5. public:
  6. operator bool() {
  7. cout << "bool\n";
  8. return true;
  9. }
  10.  
  11. bool operator!() {
  12. cout << "not\n";
  13. return false;
  14. }
  15. };
  16.  
  17. int main() {
  18. A a;
  19.  
  20. if (!a) {
  21. std::cout << "HELLO";
  22. } else {
  23. std::cout << "WORLD";
  24. }
  25. std::cout << std::endl;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
not
WORLD