Puoi creare una funzione "Create" in un modulo helper che accetta il parametro in questione, crea il nuovo oggetto e lo restituisce.
Usando property friend puoi anche scrivere classi più incapsulate.codice:'Nel modulo di classe "MyClass" Public int As Integer Public dbl As Double Private Sub Class_Initialize() int=5 'Int è *sempre* uguale a 5 End Sub 'Nel modulo Public Function Create(ByVal dbl As Double) As MyClass Dim mc As New MyClass mc.dbl=dbl Create=mc End Sub

Rispondi quotando