Add solution for task 2_5 using class