{"action":"created","issue":{"url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/17","labels_url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/17/comments","events_url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/17/events","html_url":"https://github.com/ReadingLab/Discussion-for-Cpp/issues/17","id":72145560,"number":17,"title":"Exercise 7.35 问题","user":{"login":"csbdong","id":12005953,"avatar_url":"https://avatars.githubusercontent.com/u/12005953?v=3","gravatar_id":"","url":"https://api.github.com/users/csbdong","html_url":"https://github.com/csbdong","followers_url":"https://api.github.com/users/csbdong/followers","following_url":"https://api.github.com/users/csbdong/following{/other_user}","gists_url":"https://api.github.com/users/csbdong/gists{/gist_id}","starred_url":"https://api.github.com/users/csbdong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csbdong/subscriptions","organizations_url":"https://api.github.com/users/csbdong/orgs","repos_url":"https://api.github.com/users/csbdong/repos","events_url":"https://api.github.com/users/csbdong/events{/privacy}","received_events_url":"https://api.github.com/users/csbdong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"pezy","id":1147451,"avatar_url":"https://avatars.githubusercontent.com/u/1147451?v=3","gravatar_id":"","url":"https://api.github.com/users/pezy","html_url":"https://github.com/pezy","followers_url":"https://api.github.com/users/pezy/followers","following_url":"https://api.github.com/users/pezy/following{/other_user}","gists_url":"https://api.github.com/users/pezy/gists{/gist_id}","starred_url":"https://api.github.com/users/pezy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pezy/subscriptions","organizations_url":"https://api.github.com/users/pezy/orgs","repos_url":"https://api.github.com/users/pezy/repos","events_url":"https://api.github.com/users/pezy/events{/privacy}","received_events_url":"https://api.github.com/users/pezy/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2015-04-30T12:38:15Z","updated_at":"2015-05-01T10:53:43Z","closed_at":null,"body":"Exercise 7.35\r\nExplain the following code, indicating which definition of Type or initVal is used for each use of those names. Say how you would fix any errors.\r\n```C++\r\ntypedef string Type;\r\ntypedef string Type;\r\nType initVal();\r\nclass Exercise {\r\npublic:\r\n\ttypedef double Type;\r\n\tType setVal(Type);\r\n\tType initVal();\r\nprivate:\r\n\tint val;\r\n};\r\nType Exercise::setVal(Type parm) {\r\n\tval = parm + initVal();\r\n\treturn val;\r\n}\r\n```\r\n\r\n有个疑问，为什么```Type Exercise::setVal(Type parm) ``` 中第一个Type是指```typedef string Type```\r\n按照查找的原则不是先在成员函数内查找（此处未找到），然后在类内查找吗？（此处找到）\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/comments/98099628","html_url":"https://github.com/ReadingLab/Discussion-for-Cpp/issues/17#issuecomment-98099628","issue_url":"https://api.github.com/repos/ReadingLab/Discussion-for-Cpp/issues/17","id":98099628,"user":{"login":"Mooophy","id":5942966,"avatar_url":"https://avatars.githubusercontent.com/u/5942966?v=3","gravatar_id":"","url":"https://api.github.com/users/Mooophy","html_url":"https://github.com/Mooophy","followers_url":"https://api.github.com/users/Mooophy/followers","following_url":"https://api.github.com/users/Mooophy/following{/other_user}","gists_url":"https://api.github.com/users/Mooophy/gists{/gist_id}","starred_url":"https://api.github.com/users/Mooophy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mooophy/subscriptions","organizations_url":"https://api.github.com/users/Mooophy/orgs","repos_url":"https://api.github.com/users/Mooophy/repos","events_url":"https://api.github.com/users/Mooophy/events{/privacy}","received_events_url":"https://api.github.com/users/Mooophy/received_events","type":"User","site_admin":false},"created_at":"2015-05-01T10:53:43Z","updated_at":"2015-05-01T10:53:43Z","body":"@Ocxs 的解释我没太看懂。但这里跟重载没关系，vs很可能是出了个小bug。\r\n\r\n我手里没有中文版，谁提供一下对应的英文版章节号。\r\n\r\n最重要的是，下面这两句话不矛盾：\r\n\r\n\r\n```\r\n1.声明中使用的名字，包括返回类型或者参数列表中使用的名字都必须在使用前保证可见。\r\n```\r\n\r\n```\r\n2.前置的返回类型是class body之外的。\r\n```"}}