class construct function