I have to write a template class which will be imitating an ordinary variable such as int. It has to be based on dynamic allocation. Following is an example:
It should include handy and useful overloaded operators and functions. Besides, I have to implement proper exception handling (according to my prerequisites, the following throws are incorrect: throw 7 or throw "Error in module foo).
So here are my questions:
1) What is proper exception handling? I should derive my own exception class from the standard one named exception?
2) Where are potentially dangerous places in such class to throw an exception?
3) What useful overloaded operators along with operator+ or operator- should I embed into my class?