{"action":"closed","issue":{"url":"https://api.github.com/repos/swifter-tips/Public-Issues/issues/47","labels_url":"https://api.github.com/repos/swifter-tips/Public-Issues/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/swifter-tips/Public-Issues/issues/47/comments","events_url":"https://api.github.com/repos/swifter-tips/Public-Issues/issues/47/events","html_url":"https://github.com/swifter-tips/Public-Issues/issues/47","id":110580069,"number":47,"title":"关于第17个tip “初始化方法顺序”  疑惑","user":{"login":"zyg-github","id":5036024,"avatar_url":"https://avatars.githubusercontent.com/u/5036024?v=3","gravatar_id":"","url":"https://api.github.com/users/zyg-github","html_url":"https://github.com/zyg-github","followers_url":"https://api.github.com/users/zyg-github/followers","following_url":"https://api.github.com/users/zyg-github/following{/other_user}","gists_url":"https://api.github.com/users/zyg-github/gists{/gist_id}","starred_url":"https://api.github.com/users/zyg-github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zyg-github/subscriptions","organizations_url":"https://api.github.com/users/zyg-github/orgs","repos_url":"https://api.github.com/users/zyg-github/repos","events_url":"https://api.github.com/users/zyg-github/events{/privacy}","received_events_url":"https://api.github.com/users/zyg-github/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-09T03:10:14Z","updated_at":"2015-11-03T12:46:45Z","closed_at":"2015-11-03T12:46:45Z","body":"原文：\r\n“这种情况下，Swift 会自动地对父类的对应 init 方法进行调用，也就是说，第 2 步的 super.init() 也是可以不用写的 (但是实际上还是调用的，只不过是为了简便 Swift 帮我们完成了)。”\r\n\r\n我试验了一下 按照你的例子是没有错 \r\n\r\n但是如果  （把 init() 修改为 init(t:Int) ）\r\nclass Cat1 {\r\n    var name: String\r\n    init(t:Int) {\r\n        name = \"cat\"\r\n    }\r\n}\r\n\r\nclass Tiger1: Cat1 {\r\n    let power: Int\r\n    override init(t:Int) {\r\n        power = 10\r\n        super.init(t: t)\r\n        //需要手动调用  super.init(t: t)\r\n    }\r\n}\r\n\r\n所以我觉得 编译器 只会帮你自动调用 super.init()（默认的初始化方法）  但其他的 非默认的init 是不会自动调用的\r\n\r\n不知道对不对？ 请大神指点一下\r\n\r\n"}}