how to create vector of objects in c++ code example
Example: make a vector of an objects c++
#include <vector>
using std::vector;
class MyClass { .... };
vector<MyClass> myVector( 100, MyClass() );
/* myVector now contains 100 objects of type MyClass, built with the default constructor */
vector<MyClass> myVector2;
// MyVector2 is empty
myVector2.assign( 100, MyClass() );
// My Vector2 now contains 100 objects of type MyClass, built with default ctor