I can understand why you need a class variable to keep track of things like the total number of objects that were created in this class.
And I can understand why you need an instance variable to store the attributes of a specific object in this class.
But class instance variables I just can't justify.
As I understand it, they are similar to class variables, except that they are not visible to subclasses like class variables .
It seems that the use of this would be very limited. Or I'm wrong? Has anyone found a good use for class instance variables in their code? Or could you give an example of a situation where this type of nuance would be valuable?
scope inheritance ruby class instance-variables
pez_dispenser
source share