InstanceObjectValue


#1

Got two questions.
Question1: Are all instance variables created inside the method which, too, is found in the class or can we come up with instance variables that are in a class but outside the method?

class Example

    def classmethod(name)
    @name = name
    end

    # or can we create an instance variable here and not in the method?

end

Question2: When creating object and we use .new method, is it necessary to give it an argument? Because from my point of view, the argument is for the method created in the class and not for the .new method
instanceexample = Example.new("MyName")

is MyName here an argument for the method in the class or for the .new method?


#2

@groundzero9999,
-1

http://stackoverflow.com/questions/11597059/ruby-initializing-instance-variable-outside-method

-2
http://stackoverflow.com/questions/16982538/is-it-possible-to-instantiate-a-ruby-class-without-calling-initialize


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.