vector with 10 objects : object vector « vector « C++ Tutorial






#include <vector>
using namespace std;

class Element
{
public:
  Element() {}
  ~Element() {}
};

int main(int argc, char** argv)
{
  vector<Element>*  elementVector = new vector<Element>(10);
  delete elementVector;
  return (0);
}








16.31.object vector
16.31.1.Store a class object in a vector.
16.31.2.vector with 10 objects
16.31.3.Object vector
16.31.4.Call member function for each element in vector
16.31.5.Call the virtual function from classes stored in a vector
16.31.6.Use vector to store the calsses in a hiearchy
16.31.7.Use vector as an array for user-defined object