• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

class method to add its interface to a collection

Started by Chris Holbrook, December 31, 2012, 12:46:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chris Holbrook

I have a class containing a method which wants to store the current object (me) in a collection. It would be great to just say "myvariant = me", etc. But the compiler says no.

I can clone the current object by creating a new instance and copying each instance variable from the current object to it. But then I have effectively two definitions of the interface, one in the class declarations and the other in my cloning method, which is at the mercy of my coding and maintenance skills.

Is there an alternative way of grabbing the entire current object into a variant?



Stan Duraham

this might work


        Local o As IUnknown
        Local v As Variant
        o = Me
        v = o