Solution for code generated in class