File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,16 @@ impl Circle {
100
100
std::f64::consts::PI * (self.radius * self.radius)
101
101
}
102
102
103
- fn grow(&self) -> Circle {
104
- Circle { x: self.x, y: self.y, radius: ( self.radius * 10.0) }
103
+ fn grow(&self, increment: f64 ) -> Circle {
104
+ Circle { x: self.x, y: self.y, radius: self.radius + increment }
105
105
}
106
106
}
107
107
108
108
fn main() {
109
109
let c = Circle { x: 0.0, y: 0.0, radius: 2.0 };
110
110
println!("{}", c.area());
111
111
112
- let d = c.grow().area();
112
+ let d = c.grow(2.0 ).area();
113
113
println!("{}", d);
114
114
}
115
115
```
@@ -124,7 +124,7 @@ fn grow(&self) -> Circle {
124
124
```
125
125
126
126
We just say we're returning a ` Circle ` . With this method, we can grow a new
127
- circle with an area that's 100 times larger than the old one .
127
+ circle to any arbitrary size .
128
128
129
129
## Static methods
130
130
You can’t perform that action at this time.
0 commit comments