fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. class cls {
  5. public:
  6. cls() {cls(5);}
  7. cls(int n) {v.resize(n);}
  8. std::vector<int> v;
  9. };
  10.  
  11. int main(int argc, const char* argv[]) {
  12. cls x, y(5);
  13. std::cout << x.v.size() << std::endl; // prints 5
  14. std::cout << y.v.size(); // prints 0
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
0
5