Methods by Reference
price method isn’t great. If you remember from before, we ran into problems when we moved the
Fruit value into the
price_fruit function. When you have a parameter named
self, it means “move it into this method.” Fortunately, methods work with references as well.
&self and make sure your program still compiles and works.