Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include<vector>
  2. #include<iostream>
  3. #include<string>
  4.  
  5. class SomeObject {
  6.  
  7. private:
  8.     std::vector<std::string> squares;
  9.  
  10. public:
  11.     SomeObject() {}
  12.    
  13.     void fill() {
  14.         squares.push_back(std::string("one"));
  15.         squares.push_back(std::string("two"));
  16.     }
  17.  
  18.     void print() const {
  19.         for (std::string s : squares) {
  20.             std::cout << s << std::endl;
  21.         }
  22.     }
  23. };
  24.  
  25. int main() {
  26.     SomeObject o = SomeObject();
  27.     o.fill();
  28.     o.print();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement