Created
October 9, 2008 19:37
-
-
Save dyoder/15863 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ypcmc02106:pages dyoder$ irb | |
irb(main):001:0> class A ; attr_accessor :foo ; def initialize; foo = String.new ; end ; end | |
=> nil | |
irb(main):002:0> a1 = A.new | |
=> #<A:0x86970> | |
irb(main):003:0> a2 = a1.dup | |
=> #<A:0x82a64> | |
irb(main):004:0> a1.foo = 'hello' | |
=> "hello" | |
irb(main):005:0> a2.foo | |
=> nil | |
irb(main):006:0> a2.foo = 'goodbye' | |
=> "goodbye" | |
irb(main):007:0> a1.foo | |
=> "hello" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment