task #6 refactored to cpp type cast