fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. class x {
  5. public:
  6. int var1, var2;
  7. x(int v1, int v2):var1(v1), var2(v2) {}
  8. };
  9.  
  10. int main() {
  11. std::vector<x> teste;
  12. x obj1(10,20);
  13. teste.push_back(obj1);
  14.  
  15. std::cout<<teste[0].var1<< " " <<teste[0].var2;
  16. return 0;
  17. }
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
10 20