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

Technology CommunityCategory: RubyWhat is the difference between an Instance Variable and a Class Variable?
VietMX Staff asked 3 years ago
  • 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.