There is one part of your code that's particularly disturbing:
std::bagCapacity_ = 10;
This seems to indicate that you're creating a variable named bagCapacity
in the std
namespace. Unless I'm misunderstanding what's going on here, this is strictly verboten -- there are only a few things you're allowed to add to the std
namespace (primarily specializations of templates that are already there).
I'm also left wondering what you're doing here. Using new[]
is nearly always a mistake. What you're writing looks suspiciously like a mediocre imitation of a vector
, so unless this is something on the order of a class assignment intended to teach some specific (rather poor) technique, you'd probably be better off asking about what you're actually trying to accomplish, and getting advice about a good way to do that instead.