Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, January 20, 2013

Codecademy Sample Solution: Instantiation Nation



class Computer
@@users = {}

def Computer.get_users
return @@users
end

def initialize(username, password)
@username = username
@password = password
@files = {}
@@users[username] = password
end

def create(filename)
@filename = filename
@time = Time.now
@files[filename] = @time
puts "A new file was created: #{@filename} #{@username} #{@time}"
end
end

my_computer = Computer.new("Jim", test)

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts