Throwing Exceptions in Cpp and the idea of a virtual method

Hi there! Well, the 30 days of code from HackerRank had some challenges that didn’t allow me to use Go and this is one of them. The idea is to create a custom exception and throw it. My choice of language was C++ and the solution is given below. Notice that not all code is mine, the IO handling was given by HackerRank (probably to force me use a class Calculator and an exception haha)....

October 1, 2016 · 3 min