34,333
edits
Changes
→Instance Methods
== Instance Methods ==
Although we looked briefly at instance methods earlier in this chapter we have so far focused on sotrage storage of data in a class.
Instance methods are methods that can be called on an instance of the class. Instance methods can access class variables to perform tasks, and can also accept values as arguments. For example, we can add a method to our class that takes a new account balance as an argument and using use the @@interest_rate class variable to calculate the interest due:
<pre>