Vectors keep track of their size. And to be efficient, a[nElems]
will assume that your vector
is large enough to accommodate that access.
It looks like you want:
void ArrayS::insert(long value) // put element into array
{
a.push_back(value); // insert it AND increment size
}
It also looks like you can disregard nElems
. If you want the vector's size, just call a.size()
.