Originally Posted by
Paul McKenzie
The idea is this
You are to assume that you have no idea how the parent class makes copies.. This means that the only choice you have is to call the parent class assignment operator.
What if the parent class assignment operator changes? Are you going to fix your code trying to make those same changes in NumericArray? Why do that? Just call the parent assignment operator and let it do its work, whatever that work is.
When you make a copy, you're supposed to make sure that the parent make its copy too. Your code did not do that, instead you just copied and pasted what the parent class did. What if the assignment in the parent was a 1,000 line function? Are you going to copy and paste 1,000 lines of code in your NumericArray assignment operator?
You make the exact same mistake with your destructor -- why are you doing the work that the Array base class will do? Just let the Array class destructor do its job -- there is no need for you to duplicate code.
Regards,
Paul McKenzie