Let’s say that the instance of
wants to access the condition of coffee.
But there is a problem.
CoffeeMaker can’t access
Only the methods can access instance variables.
Let’s see an example.
In the below case we are getting error
undefined method condition.
In order to fix this problem we can create a method which will return the instance variable.
Now the code will work because we added a method
condition which is returning the instance variable