All,

I am creating getters and setters for my package which uses S4.  To research 
getters and setters, I have been looking at the bio conductor website and 
documentation provided therein.  I came up with the below as a getter for the 
object PassThrough.  This works PrepaidPrin(PassThrough).  

The passthrough object has 50 slots and I have on the order of about 35 new 
classes.  Some of which are subclasses as well.  Thus, PrepaidPrin is also a 
slot in another class ScenarioTotalReturn.  So, I need multiple dispatch but I 
am still research that.  Before I started down this road I thought I would 
solicit opinions as to what I propose to make sure I have the basics correct.

Best,
Glenn


 #' A standard generic function to access the slot PrepaidPrin
 #' @param object an object whose method signature is PassThrough
 #' @export
 setGeneric("PrepaidPrin", function(object)
   {standardGeneric("PrepaidPrin")})

 #' Method to extract Prepaid Principal from class PassThrough
 #' @param object the name of the object of type PassThrough
 #' @exportMethod PrepaidPrin
 setMethod("PrepaidPrin", signature("PassThrough"),
           function(object){object@PrepaidPrin})
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to