class with function