Cpp_Primer_Answers
Cpp_Primer_Answers copied to clipboard
练习7.35答案有问题
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;
}