1. how do i access a class's function if said class is part of an std::vector.
1 2
std::vector<Obstacle> m_obstacles(2); // using [2] would create an array of vectors. it doesnt look like you want this.
m_obstacles[0].function(); // etc
2. I am trying to find the size of a vector, i have used the vector.size() function but i get the following error:
Use uniform or copy initialization to give default values to class members or initialize them in constructor:
1 2 3
private:
//One parameter constructor is explicit so we need to instantiate a temporary directly
std::vector<Obstacle> m_obstacles = std::vector<Obstacle>(200); //Copy initialization