Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby attr_writer example

class Person
  attr_reader :name
  attr_writer :name

  def initialize(name)
    @name = name
  end
end

john = Person.new("John")
john.name = "Jim"
puts john.name # => Jim
Source by mixandgo.com #
 
PREVIOUS NEXT
Tagged: #ruby
ADD COMMENT
Topic
Name
6+1 =