On Apr 04, 2007, at 18:50 UTC, Frank Condello wrote: > Example: > > Dim c1 As New MySubClass > Dim c2 As MySubClass > c2 = MySubClass( c1.Clone ) > > If MySubClass is an Object3D that code will run fine, but if the > super is a home-brewed class that supplies a Clone function you'll > get a not-so-unexpected illegal cast exception. I can't think of a > way to do this in RB code - does Object3D use some sort of plugin SDK > voodoo?
Yes. Plugins have a way to get a reference to the class of an object, and then use that to create a new instance of the same class. However, I'm not sure I see a real problem -- in your own classes, define a Clone method to return the base class type. Subclasses should override this to return an instance of their class (but still using the base class as the return type, else it wouldn't be overriding). The only thing special about Object3D.Clone is that subclasses don't have to override Clone to make it work, and in your own hierarchy, they do. Best, - Joe -- Joe Strout -- [EMAIL PROTECTED] Verified Express, LLC "Making the Internet a Better Place" http://www.verex.com/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
