fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Message
  6. {
  7. public:
  8. string text;
  9. Message(string msg) :text(msg) {}
  10. bool operator==(const string& s) const {
  11. return s == text;
  12. }
  13. };
  14.  
  15. int main()
  16. {
  17. string a = "a";
  18. Message aa(a);
  19. if (aa == a) {
  20. cout << "Okay" << endl;
  21. }
  22. // if (a == aa) {
  23. // cout << "Not Okay" << endl;
  24. // }
  25. }
  26.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Okay