Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Produces a shallow copy of obj---the instance variables of obj are
- copied, but not the objects they reference.
- class Klass
- attr_accessor :name
- end
- a = Klass.new
- a.name = "John"
- b = a.dup
- b.name = "Sue"
- puts a.name # John
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement