{"action":"created","comment":{"url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/comments/34510373","id":34510373,"diff_hunk":"@@ -137,14 +139,62 @@ affiche_animal(chat);\n affiche_animal(spider);\n ```\n \n-Et voilà ! Beaucoup plus simple, n'est-ce pas ?\n+Pourquoi?\n \n-\"On ne pourrait pas plus simplement créer une fonction afficher dans le trait Animal ?\"\n-Excellente idée !\n+Les traits ne peuvent prendre en compte dans les méthodes par défaut le travail sur des valeurs prises en compte dans l'objet en paramètre (ici: \"self\")! En effet, ils ne peuvent prendre en compte des attributs qui, peut-être, ne seront pas contenus dans des structures en héritant!\n+\n+Voici un code fonctionnant pour ce cas :\n \n ```Rust\n-chat.afficher();\n-spider.afficher();\n+struct Chien {\n+    nom: String,\n+    nombre_pattes: usize\n+}\n+\n+struct Chat {\n+    nom: String,\n+    nombre_pattes: usize\n+}\n+\n+trait Animal {\n+    fn getNom(&self) -> ();\n+    fn getNbPattes(&self) -> ();\n+    fn affiche(&self) -> () {\n+        println!(\"Je suis un animal\");\n+    }\n+}\n+\n+impl Animal for Chien {\n+    fn getNom(&self) -> () {\n+        println!(\"{}\", self.nom);\n+    }\n+    fn getNbPattes(&self) -> () {\n+        println!(\"{}\", self.nombre_pattes);\n+    }\n+}\n+\n+impl Animal for Chat {\n+    fn getNom(&self) -> () {\n+        println!(\"{}\", self.nom);\n+    }\n+    fn getNbPattes(&self) -> () {\n+        println!(\"{}\", self.nombre_pattes);\n+    }\n+}\n+\n+fn main() {\n+\n+    let chien = Chien {nom : \"Rufus\".to_string(), nombre_pattes : 4};\n+    let chat = Chat {nom : \"Félix\".to_string(), nombre_pattes : 4};\n+\n+    chien.getNom();\n+\n+    chat.getNbPattes();\n+\n+    chien.affiche();\n+    chat.affiche();\n+","path":"src/2_4.md","position":100,"original_position":100,"commit_id":"f7eea153d6c5153167488a5ceb30f227856e0e1e","original_commit_id":"f7eea153d6c5153167488a5ceb30f227856e0e1e","user":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"body":"This empty line should be removed.","created_at":"2015-07-13T20:53:24Z","updated_at":"2015-07-13T20:53:24Z","html_url":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8#discussion_r34510373","pull_request_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/comments/34510373"},"html":{"href":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8#discussion_r34510373"},"pull_request":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8","id":39853384,"html_url":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8","diff_url":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8.diff","patch_url":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8.patch","issue_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/8","number":8,"state":"open","locked":false,"title":"Update 2_4, 2_6 and 2_7","user":{"login":"k0pernicus","id":3605451,"avatar_url":"https://avatars.githubusercontent.com/u/3605451?v=3","gravatar_id":"","url":"https://api.github.com/users/k0pernicus","html_url":"https://github.com/k0pernicus","followers_url":"https://api.github.com/users/k0pernicus/followers","following_url":"https://api.github.com/users/k0pernicus/following{/other_user}","gists_url":"https://api.github.com/users/k0pernicus/gists{/gist_id}","starred_url":"https://api.github.com/users/k0pernicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k0pernicus/subscriptions","organizations_url":"https://api.github.com/users/k0pernicus/orgs","repos_url":"https://api.github.com/users/k0pernicus/repos","events_url":"https://api.github.com/users/k0pernicus/events{/privacy}","received_events_url":"https://api.github.com/users/k0pernicus/received_events","type":"User","site_admin":false},"body":"Correction of an exercise and a mistake about introducing the new chapter","created_at":"2015-07-13T20:35:12Z","updated_at":"2015-07-13T20:53:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"008a9ecc06b99a1eb0100c0e75417de69a57c782","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8/commits","review_comments_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8/comments","review_comment_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/8/comments","statuses_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/statuses/f7eea153d6c5153167488a5ceb30f227856e0e1e","head":{"label":"k0pernicus:master","ref":"master","sha":"f7eea153d6c5153167488a5ceb30f227856e0e1e","user":{"login":"k0pernicus","id":3605451,"avatar_url":"https://avatars.githubusercontent.com/u/3605451?v=3","gravatar_id":"","url":"https://api.github.com/users/k0pernicus","html_url":"https://github.com/k0pernicus","followers_url":"https://api.github.com/users/k0pernicus/followers","following_url":"https://api.github.com/users/k0pernicus/following{/other_user}","gists_url":"https://api.github.com/users/k0pernicus/gists{/gist_id}","starred_url":"https://api.github.com/users/k0pernicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k0pernicus/subscriptions","organizations_url":"https://api.github.com/users/k0pernicus/orgs","repos_url":"https://api.github.com/users/k0pernicus/repos","events_url":"https://api.github.com/users/k0pernicus/events{/privacy}","received_events_url":"https://api.github.com/users/k0pernicus/received_events","type":"User","site_admin":false},"repo":{"id":39023796,"name":"tuto-rust-fr","full_name":"k0pernicus/tuto-rust-fr","owner":{"login":"k0pernicus","id":3605451,"avatar_url":"https://avatars.githubusercontent.com/u/3605451?v=3","gravatar_id":"","url":"https://api.github.com/users/k0pernicus","html_url":"https://github.com/k0pernicus","followers_url":"https://api.github.com/users/k0pernicus/followers","following_url":"https://api.github.com/users/k0pernicus/following{/other_user}","gists_url":"https://api.github.com/users/k0pernicus/gists{/gist_id}","starred_url":"https://api.github.com/users/k0pernicus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k0pernicus/subscriptions","organizations_url":"https://api.github.com/users/k0pernicus/orgs","repos_url":"https://api.github.com/users/k0pernicus/repos","events_url":"https://api.github.com/users/k0pernicus/events{/privacy}","received_events_url":"https://api.github.com/users/k0pernicus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/k0pernicus/tuto-rust-fr","description":"Un tutoriel pour apprendre Rust","fork":true,"url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr","forks_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/forks","keys_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/teams","hooks_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/hooks","issue_events_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/issues/events{/number}","events_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/events","assignees_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/assignees{/user}","branches_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/branches{/branch}","tags_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/tags","blobs_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/git/refs{/sha}","trees_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/statuses/{sha}","languages_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/languages","stargazers_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/stargazers","contributors_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/contributors","subscribers_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/subscribers","subscription_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/subscription","commits_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/commits{/sha}","git_commits_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/git/commits{/sha}","comments_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/comments{/number}","issue_comment_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/issues/comments{/number}","contents_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/contents/{+path}","compare_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/merges","archive_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/downloads","issues_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/issues{/number}","pulls_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/pulls{/number}","milestones_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/milestones{/number}","notifications_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/labels{/name}","releases_url":"https://api.github.com/repos/k0pernicus/tuto-rust-fr/releases{/id}","created_at":"2015-07-13T16:27:01Z","updated_at":"2015-06-22T08:05:06Z","pushed_at":"2015-07-13T20:33:45Z","git_url":"git://github.com/k0pernicus/tuto-rust-fr.git","ssh_url":"git@github.com:k0pernicus/tuto-rust-fr.git","clone_url":"https://github.com/k0pernicus/tuto-rust-fr.git","svn_url":"https://github.com/k0pernicus/tuto-rust-fr","homepage":"http://blog.guillaume-gomez.fr/Rust","size":485,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"GuillaumeGomez:master","ref":"master","sha":"9af69e6fd8198505b9715543e1b2c6592d765e68","user":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"repo":{"id":36029256,"name":"tuto-rust-fr","full_name":"GuillaumeGomez/tuto-rust-fr","owner":{"login":"GuillaumeGomez","id":3050060,"avatar_url":"https://avatars.githubusercontent.com/u/3050060?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeGomez","html_url":"https://github.com/GuillaumeGomez","followers_url":"https://api.github.com/users/GuillaumeGomez/followers","following_url":"https://api.github.com/users/GuillaumeGomez/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeGomez/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeGomez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeGomez/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeGomez/orgs","repos_url":"https://api.github.com/users/GuillaumeGomez/repos","events_url":"https://api.github.com/users/GuillaumeGomez/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeGomez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GuillaumeGomez/tuto-rust-fr","description":"Un tutoriel pour apprendre Rust","fork":false,"url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr","forks_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/forks","keys_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/teams","hooks_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/hooks","issue_events_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/events{/number}","events_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/events","assignees_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/assignees{/user}","branches_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/branches{/branch}","tags_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/tags","blobs_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/git/refs{/sha}","trees_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/statuses/{sha}","languages_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/languages","stargazers_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/stargazers","contributors_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/contributors","subscribers_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/subscribers","subscription_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/subscription","commits_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/commits{/sha}","git_commits_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/git/commits{/sha}","comments_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/comments{/number}","issue_comment_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/comments{/number}","contents_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/contents/{+path}","compare_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/merges","archive_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/downloads","issues_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues{/number}","pulls_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls{/number}","milestones_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/milestones{/number}","notifications_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/labels{/name}","releases_url":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/releases{/id}","created_at":"2015-05-21T18:06:17Z","updated_at":"2015-06-22T08:05:06Z","pushed_at":"2015-07-13T20:35:12Z","git_url":"git://github.com/GuillaumeGomez/tuto-rust-fr.git","ssh_url":"git@github.com:GuillaumeGomez/tuto-rust-fr.git","clone_url":"https://github.com/GuillaumeGomez/tuto-rust-fr.git","svn_url":"https://github.com/GuillaumeGomez/tuto-rust-fr","homepage":"http://blog.guillaume-gomez.fr/Rust","size":485,"stargazers_count":5,"watchers_count":5,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8"},"html":{"href":"https://github.com/GuillaumeGomez/tuto-rust-fr/pull/8"},"issue":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/8"},"comments":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/GuillaumeGomez/tuto-rust-fr/statuses/f7eea153d6c5153167488a5ceb30f227856e0e1e"}}}}