From 725ea14d80fd348d3cfb4eb096c3d6d34c4a509c Mon Sep 17 00:00:00 2001 From: Sudo Nice Date: Sat, 25 Jul 2020 07:48:42 +0300 Subject: [PATCH] Fix misleading Self explanation closes #21 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3806e3b..ca3d7b9 100644 --- a/README.md +++ b/README.md @@ -2329,8 +2329,8 @@ struct Animal { impl Animal { fn new() -> Self { - // Self means AnimalType. - //You can also write AnimalType instead of Self + // Self means Animal. + //You can also write Animal instead of Self Self { // When we write Animal::new(), we always get a cat that is 10 years old @@ -2393,7 +2393,7 @@ The animal is a cat Remember that Self (the type Self) and self (the variable self) are abbreviations. (abbreviation = short way to write) -So in our code, Self = AnimalType. Also, `fn change_to_dog(&mut self)` means `fn change_to_dog(&mut AnimalType)` +So in our code, Self = Animal. Also, `fn change_to_dog(&mut self)` means `fn change_to_dog(&mut Animal)` ## Generics