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!
Nirav B. 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
On 21 Dec, 06:58, Nirav B. [email protected] 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