What is the difference between an Instance Variable and a Class Variable?

Technology Community › Category: Ruby › What is the difference between an Instance Variable and a Class Variable?
VietMX Staff asked 5 years ago
  • A class variable is evaluated in reference to the class object created by the enclosing class definition while
  • an instance variable is evaluated in reference to self. Instance variables cannot be referenced outside of instance methods.