fork download
  1.  
  2. #include <string>
  3. #include <iostream>
  4.  
  5. class MyClass {
  6.  
  7. std::string my_string;
  8.  
  9. public:
  10.  
  11. void Init() {
  12. my_string = "Hello!";
  13. }
  14.  
  15. std::string GetMyString() {
  16. return my_string;
  17. }
  18.  
  19. };
  20.  
  21. int main() {
  22. MyClass obj;
  23. obj.Init();
  24. std::cout << obj.GetMyString();
  25. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
Hello!