why we cannot intialize with vector size in class in c++?
#include <bits/stdc++.h>
using namespace std;
class s{
public:
vector<int> arr(4);
};
int main()
{
cout<<"Hello World";
int n = 10;
std::vector<int> arr(n);
return 0;
}
in this code i have intialize arr with 4 size but it showing error
we can intialize vector with size but why we cannot intialize
why it showing error:
main.cpp:15:24: error: expected identifier before numeric constant
15 | vector<int> arr(4);
| ^
main.cpp:15:24: error: expected ‘,’ or ‘...’ before numeric constant