huangmingchuan / Cpp_Primer_Answers

《C++ Primer》第五版中文版习题答案

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

练习7.35答案有问题

zy979228369 opened this issue · 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;
}