summaryrefslogtreecommitdiff
path: root/sample/clone.rb
blob: e7d6b00a31498208f01e2e9c47cec30dbb4043f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# object cloning & single method test
# output:
#	test2
#	test
#	test
#	clone.rb:18: undefined method `test2' for "#<Object: 0xbfca4>"(Object)
foo = Object.new
def foo.test
  print("test\n")
end
bar = foo.clone
def bar.test2
  print("test2\n")
end
bar.test2
bar.test
foo.test
foo.test2