ex6.2 - double implementation