Instance Vs Class Variables Notes Flashcards
1
Q
what is an instance variable?
A
an instance variable, also known as an @attribute are variables that we assign to each instance of our class when we initialize them. it constantly gets reassigned every time you create a new class object.
2
Q
what are class variables?
A
a @@class_variable will be shared among all instances of a class; changing the variable will effect all instances.
3
Q
what are class constants?
A
a CLASS_CONSTANT will be shared among all instances of a class, but cannot be changed