2. Whenever a method receives a pointer as a parameter, it can check whether it is equal to nullptr and do the appropriate thing. This is part of good defensive programming. Don't assume other parts of your program are acting as they should.
2) Are we going to assume that null data will never be inserted in the insert method in BST.hpp?
3. Note that we will not test for this corner case, as we didn't specify that you needed to handle the case in the writeup.
(This is a general rule, we won't hold you responsible for details left unspecified)
However, testing this corner case could be helpful during code development, much as cassert can be useful
The reason you should use nullptr instead of NULL: http://www.devx.com/cplus/10MinuteSolution/35167
No comments:
Post a Comment