M
Mido Peace
Hey ..
I'm Tryin' to port Some Java Module into Ruby , but I have a small
probleme ,
how can I do to declare multi 'initialize Method' depending of the
number of user
argument
i.e in Java we can have a Class with many constructor
class myClass {
//...
public MyClass () { ... } // Defualt One
public MyClass (Object obj1 ) { ... }
public myClass ( Object obj1,Object obj2 ...,Object objn) { ... }
// ...
}
I tried :
class myClass
def initialize ()
// ...
end
def intialize ( value )
// ...
end
end
but doesnt works !
I just wanna find a way to call the right constructor ( or initializer)
depending of the number of arguments
Thx
I'm Tryin' to port Some Java Module into Ruby , but I have a small
probleme ,
how can I do to declare multi 'initialize Method' depending of the
number of user
argument
i.e in Java we can have a Class with many constructor
class myClass {
//...
public MyClass () { ... } // Defualt One
public MyClass (Object obj1 ) { ... }
public myClass ( Object obj1,Object obj2 ...,Object objn) { ... }
// ...
}
I tried :
class myClass
def initialize ()
// ...
end
def intialize ( value )
// ...
end
end
but doesnt works !
I just wanna find a way to call the right constructor ( or initializer)
depending of the number of arguments
Thx