Corrected 'paintjob', added text (#25367)
Text added: ", and wanted to change the color of your Car."
This commit is contained in:
@ -51,7 +51,7 @@ Now, to create an instance of this class you only need to call the `.new` functi
|
||||
mazda3 = Car.new('Mazda', 'Mazda3', 'White')
|
||||
```
|
||||
|
||||
This is great, but sometimes you may need to change some of these attributes! Most of these attributes in this example would be static. Still, imagine that you decided to get a new paintjob. How would you go about updating the state of this instance of the `Car` object?
|
||||
This is great, but sometimes you may need to change some of these attributes! Most of these attributes in this example would be static. Still, imagine that you decided to get a new paint job, and wanted to change the color of your Car. How would you go about updating the state of this instance of the `Car` object?
|
||||
|
||||
### Modifying Instance State
|
||||
|
||||
@ -106,4 +106,4 @@ Did you mean? make
|
||||
Viewing the previous output from `irb`, you can see that each one of the instance variables is readable. We can write to `@color`, but we end up causing a `NoMethodError` exception when we attempt to write to `@make`. This is because `@make` was only defined using an `attr_reader`, so `make=` is not defined.
|
||||
|
||||
### Resources
|
||||
- [Ruby Programming/Syntax/Classes](https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Classes)
|
||||
- [Ruby Programming/Syntax/Classes](https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Classes)
|
||||
|
Reference in New Issue
Block a user