fork download
  1. #include <vector>
  2. #include <string>
  3. #include <iostream>
  4. #include <sstream>
  5.  
  6. using namespace std;
  7.  
  8. class test {
  9. vector<string> v;
  10. public:
  11. test() {
  12. v.push_back("Hello");
  13. }
  14.  
  15. void print() {
  16. for(vector<string>::iterator it=v.begin(); it!=v.end(); ++it) {
  17. cout << *it;
  18. }
  19. cout << endl;
  20. }
  21.  
  22. vector<string>& operator~() {
  23. return v;
  24. }
  25. };
  26.  
  27. int main(){
  28. test A;
  29. A.print();
  30. vector<string> c;
  31. c.push_back("world");
  32. ~A = c;
  33. A.print();
  34. }
Success #stdin #stdout 0s 2988KB
stdin
Standard input is empty
stdout
Hello
world