add chap2 code, class test