Keddie,
you are right about constructors and destructors but you can get round it to an extent.
Say you have a class CJones
You can write an initialisation procedure, Init, say, to initialise the values in the class. (These would be user set values that cannot be set in the Class_Initialize event)
Then you write a Public Function in a BAS module to instantiate the class.Code:Friend Sub Init(Optional Age As Variant, Optional Height As Variant) If Not IsMissing(Age) Then Me.Age = Age If Not IsMissing(Height) Then Me.Height = Height End Sub
Then you ask users to write:Code:Public Function New_CJones(Optional Age As Variant, Optional Height As Variant) Set New_CJones = New CJones New_CJones.Init Age, Height End Function
You cannot force the user to use the changed code but you can utilise this internally.Code:Dim j As CJones Set j = New_CJones(10, "1.92 Metres")
I know all that does not answer the question, but I thought you might be interested.
Cheers,
P.




Reply With Quote