HackerRank Virtual Functions in C++ problem solution - TheCScience