Cpp_Primer_Answers icon indicating copy to clipboard operation
Cpp_Primer_Answers copied to clipboard

练习7.35答案有问题

Open zy979228369 opened this issue 5 years ago • 0 comments

typedef string Type; Type initVal(); //Type为string class Exercise { public: typedef double Type;//type为double Type setVal(Type);//type为double Type initVal(); //type为double private: int val; }; Type Exercise::setVal(Type parm) {//第一个type为string,第二个type为double ,此处有错误第一个type应改为Exercise::Type val = parm + initVal(); //调用成员函数initVal()
return val; }

zy979228369 avatar Feb 16 '20 09:02 zy979228369