fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #include <string.h>
  5.  
  6. class String; //We need to know there will be a class String for Boolean declaration
  7.  
  8. class Boolean {
  9. bool value = false;
  10. public:
  11. Boolean(bool value) { this -> value = value; }
  12. //We can't implement this yet since it requires
  13. // calling String functions which haven't been declared yet
  14. String toString();
  15. };
  16.  
  17. class String {
  18. char* value;
  19. public:
  20. String(const char* value) { this -> value = strdup(value); }
  21. //This is fine to implement since Boolean is already fully declared
  22. Boolean isEmpty() { return Boolean(!strcmp(value, "")); }
  23. };
  24.  
  25. //String has been declared, now we can implement this function
  26. String Boolean::toString() { return String(value ? "true" : "false"); }
  27.  
  28. int main() {
  29. // your code goes here
  30. return 0;
  31. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty