Closed agstudy closed 9 years ago
I'm not sure what you mean. Can you supply an example?
I mean that the class can have one than more initializer: Something like :
initialize = function(x){
.....
},
## second ctor with 2 parameters
initialize = function(x,y){
.....
},
The idea is to create my object using multi constructors;
Obj$new(1)
or
Obj$new(1,2)
I know that I can deal with this using something like :
initialize = function(...){
## deal with args here
}
But I am just asking in case there already is built-in feature that deal with this.
Sorry, R in general doesn't do that sort of function overloading. The version of your function with ...
is probably the way to go.
I know. I think we should get better well-typed behavior. S4 looks better armed for this feature than R6. Anyway thank you for your feedback.
Is there multiple constructor feature within R6? initialize overloading ?