I am shocked that we can change the value of constant in ruby!! is there any meaning if we can change the value of a constant!! I am not getting this,plz help!
on 2012-12-21 23:20
on 2012-12-21 23:32
On 21 Dec, 06:58, Nirav Bhatu <nirav.bha...@gmail.com> wrote: > I am shocked that we can change the value of constant in ruby!! is there > any meaning if we can change the value of a constant!! I am not getting > this,plz help! Ruby lets you do most things if you want to - calling private methods, changing constants, redefining methods on core classes - with great power comes great responsibility! Fred
on 2012-12-22 00:34
Nirav Bhatu wrote in post #1089902: > I am shocked that we can change the value of constant in ruby!! > What about this: class Dog def initialize(password) @secret = password end end d = Dog.new("flower52") puts d.instance_eval("@secret") --output:-- flower52
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.