Hi,
I'm about the head out of the office next 48 hours, but the short
answer is to override the finalize() method in your subclass of
Object. This will be called when R garbage collects the object. From
?finalize.Object:
setConstructorS3("MyClass", function() {
extend(Object(), "MyClass")
Has anyone figured out how to create a destructor in R.oo?
How I'd like to use it: I have an object which opens a connection thru RODBC
(held as a private member) It would be nice if the connection closes
automatically
(inside the destructor) when an object gets gc()'ed.
Thanks in advance.
Re