Ruby doesn't have pointers or references the way C++ does. To get similar
behavior, you can mimic it using a 1-element array. That's what 7stud--
was demonstrating, though some description of the theory would have
helped.
--Ken
···
On Fri, 18 Apr 2008 14:33:48 -0500, Dmitry Regent wrote:
a = [10]
b = a
c = a
a[0] = 20
puts b[0]
puts c[0]
--output:--
20
20
This way you are correcting existed object. But if you will do
a = Array.new
a =>
but!
b = [20]
c = [20]
I want to get C++ analog in ruby for operation with pointer. When i can
destract object and constract new with this pointer.
--
Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/