Automated generation of class routines