M
Marco
Hi All!
I'm trying to teach my Parent class how to set variables into its Child
class; ie
class Parent
def self.set_my_class_variable(value)
reference_to_my_class.my_variable = value
end
end
class Child
set_my_class_variable "hello world"
end
I think what I'm missing is the way to reference the Child class. I've
been wrongly supposing that
Parent.set_my_class_variable(value)
@@my_variable = value
end
would be doing the work. But the '@@' syntax sets the class variable to
Parent.
Thank you,
Marco
I'm trying to teach my Parent class how to set variables into its Child
class; ie
class Parent
def self.set_my_class_variable(value)
reference_to_my_class.my_variable = value
end
end
class Child
set_my_class_variable "hello world"
end
I think what I'm missing is the way to reference the Child class. I've
been wrongly supposing that
Parent.set_my_class_variable(value)
@@my_variable = value
end
would be doing the work. But the '@@' syntax sets the class variable to
Parent.
Thank you,
Marco