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

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


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 ="MyName")

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





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