Top "Instance-variables" questions

In object-oriented programming with classes, an instance variable is a variable defined in a class (i.e. a member variable), for which each object of the class has a separate copy.

Ruby on Rails- :symbols, @iVars and "strings" - oh my!

New to Rails and trying to get my head around when/why to use :symbols, @ivars , "strings" within the framework. …

ruby-on-rails ruby string symbols instance-variables
In Ruby, how can I get instance variables in a hash instead of an array?

I have a Ruby class. I want to get an instance variable from an argument to a method in that …

ruby-on-rails ruby instance-variables
How do instance variables in rspec work?

Here is a bit of code from M Hartl's Ruby on Rails Tutorial. Can anyone explain why an instance variable (@…

ruby-on-rails ruby ruby-on-rails-3 rspec instance-variables
Must every ivar be a property?

I see it recommended all over the place when coding for iOS that properties should be used for accessing instance …

objective-c ios properties instance-variables
'Use of self in method call before super.init initializes self', can't init properties through a method call

I'm curious is there is anyway to call a method inside your init method that sets instance properties of the …

swift instance-variables init
python: What happens when class attribute, instance attribute, and method all have the same name?

How does python differentiate a class attribute, instance attribute, and method when the names are the same? class Exam(object): …

python methods instance-variables class-attributes
How to create a variable name from the value of a string in Ruby on Rails?

I want to create an instance variable in a controller to be used in the view: foo = "bar" instance_variable_…

ruby instance-variables
Setting default/empty attributes for user classes in __init__

I have a decent level of programming, and get much value from the community here. However I have never had …

python class instance instance-variables python-attrs
Properties for Class and Its Subclasses Only

Is it possible to define properties that are only available to the class they are defined in, and that class's …

objective-c properties protected instance-variables
Accessing a Class' instance variable from outside

I understand (I think) the difference between class variables and instance variables of a class in Ruby. I'm wondering how …

ruby variables instance-variables class-variables