I don't have to eat all the egg to tell it's bad, right?
So, in your test sample, you always insert at the index less than
; which returns
-- quite visible with unarmed eye, even without debugger. Is that all?
Well, I don't want to examine all the code: it does not deserve it; and the problem is too trivial. But I think you ought to know what's bad in your code. Nearly everything:
maxList is hard-coded; you could use
limits.h, but this is not so important because of next item.
maxList and constant-size array is bad: you always occupy whole array in memory; it is not used if
count is less; at the same time the capacity may be not enough.
You could use heap memory instead; alternatively, you could use linked list which is better with random-position insertion.
Error_code if fantastic, wasteful anachronism: you should better use exceptions instead.
- Why all those irrelevant
- What you marked
protected should be private (deriving other classes from this one is pointless).
traverse is not flexible at all; you should have implemented iterator pattern instead; which is easy enough to do.
- You code is not readable due to poor formatting.
- Maybe, more... buy that's enough.
A school assignment? Hm...