Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. Produces a shallow copy of obj---the instance variables of obj are
  2. copied, but not the objects they reference.
  3.  
  4. class Klass
  5. attr_accessor :name
  6. end
  7.  
  8. a = Klass.new
  9. a.name = "John"
  10. b = a.dup
  11. b.name = "Sue"
  12. puts a.name # John
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement