Your myBooks objects are not initialized. You need to call the constructor on each object inside the vector. eg. mybooks[0] = new Books();

application context