Generate named function inside class body with '$' prefix