Hello,
I know that when writing a class declaration, if the class contains an array of fixed length, then the length of that array can be initialized in the class declaration, without having to do so in the constructor. For example :
But, is it also possible to do this with an std::vector? For example :Code:class MyClass { int my_array[100]; };
Or can the length of std::vectors only be set in the class constructor?Code:class MyClass { std::vector<int> my_vector(100); };
Thanks![]()




Reply With Quote