From: Paul Brannan Date: 2002-08-01T04:33:59+09:00 Subject: Re: How to Emulate C/C++ Pointer/Reference in Ruby? On Thu, Aug 01, 2002 at 03:03:47AM +0900, David Alan Black wrote: > So in Ruby, rather than the infinitely regressing line of pointer > relationships, you get something more like a circle of references, all > equidistant from the object and all terminal (in the sense that > they're at the furthest possible level away from the object). This is exactly how references work in C++, as well, e.g.: #include void foo(int & a) { std::cout << &a << std::endl; // print the address of a } void bar(int & b) { std::cout << &b << std::endl; // print the address of b foo(b); // foo gets a reference, not a reference to a reference } int main() { int x = 42; bar(x); } Should print something like: 0xbffff184 0xbffff184 because a and b are both references to the same object. Pointers, however, are a different story, altogether. (/me ignores the "Pointers, however, are a different story" echoes from the "Airplane" fans). Paul