Hi Steve,

it seems to me, that you want to pass an object inside of getDelayProfile. In this case you must use setReplaceMethod("getDelayProfile<-",....) in your definition inside the virtual and of course also in the specification of OP_Appt. R does not know, that your function should give back an object, that replaces the one on which it was called.

Otherwise making any modifications on the slot of the object inside the function will never arrive at the object outside of the function. They have two different environments and as soon as you modify an object inside of a function R builds a copy of it. See more about this by googling R pass-by-value.  

By the way: I wouldn't call this function getDelayProfile as getters and setters have usually differing a different meaning (encapsulation) in OO programming. Use rather something like fetchDelayProfile or initializeDelayProfile. It will probably make it easier for Users and Programmers to work with your program. 


Hope this helps

Best 

Simon

On Jul 16, 2013, at 3:36 PM, Steve Creamer <stephen.creamer@nhs.net> wrote:

> 


	[[alternative HTML version deleted]]

