G
Gaba Luschi
Why do you need initialize and what do you put in the parameter after
initialize(parameter)
?
initialize(parameter)
?
Well, it is called by default when one instantiates an object from a class.
Furthermore, a class need not require a parameter upon instantiation. As in,
object = MyClass.new will set up an object with default values you have
chosen in the 'initialize' method. Without 'initialize', you inherit the
base constructor from which all all classes are derived.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.