Answers for "attribute writer"

0

attribute writer

class Person
  def initialize(name)
    @name = name
  end

  def name
    @name
  end

  def password=(password)
    @password = password
  end
end
Posted by: Guest on November-21-2020
0

attribute writer

person = Person.new("Ada")
person.password=("super secret")
p person
Posted by: Guest on November-21-2020

Browse Popular Code Answers by Language