Virtual Computer 7.Instantiation Nation


#1



https://www.codecademy.com/courses/ruby-beginner-en-X5wcR/0/7?curriculum_id=5059f8619189a5000201fbcb#


Oops, try again. Did you create a variable called my_computer?
I'm 100% sure, i have correct syntax..
Nevermind,solved by moving the instantiate line outside of the class..


class Computer
    @@users = {}
    def initialize(username, password)
        @username = username
        @password = password
        @files = {}
        @@users[username] = password
    end
    def create(filename)
        time = Time.now
        @files[filename] = time
        puts "Voila! A new file was created!"
    end
    def Computer.get_users()
        return @@users
    end
end
my_computer = Computer.new("Telung", 0212)


#2

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