On Tue, Jan 17, 2012 at 8:36 PM, Tridib Bandopadhyay <tridib04 / gmail.com> w=
rote:
> How to pass reference to a class in Ruby?
>
> For example:-
>
> def func(x)
> =A0 =A0x =3D x+1
> end
>
> a =3D 5
> func(a)
> puts a

1. func is not a class, it's a method.
2. Ruby is not C++.
3. You cannot modify a variable because Ruby passes references by value.
4. The assignment in func is superfluous as you do not use x any more
after assignment.

What problem are you trying to solve?

Cheers

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/