Question: I found a way to extend classes in VBScript, but are there any ways to pass in parameters or overload the constructor? I am currently using an Init function to initialize the properties, but would like to be able to do this when I create the object.  

This is my sample class:

```
Class Test
    Private strText

    Public Property Get Text
        Text = strText
    End Property

    Public Property Let Text(strIn)
        strText = strIn
    End Property

    Private Sub Class_Initialize()  
        Init
    End Sub  

    Private Sub Class_Terminate()   

    End Sub 

    Private Function Init
        strText = "Start Text"
    End Function    
End Class

```

And I create it 

```
Set objTest = New Test

```

But would like to do something like this

```
Set objTest = New Test(strInitText)

```

Is this possible, or does the object have to be created and initialized in two setps?

Answer: 
You can work around it by having your Init function returning the object itself...

```
Class Test
  Private m_s
  Public Function Init(s)
    m_s = s
    Set Init = Me
  End Function
  Public Function Hello()
    Hello = m_s
  End Function
End Class

Dim o
Set o = (New Test).Init("hello world")
Echo o.Hello

```
A bit hackish, for sure, but when I need varargs in calls, one of my parameters I pass in as an array, i.e.

```
Rem printf done poorly
sub printf(fmt, args)
  dim fp, vap:
  dim outs:
  dim fini:
      fini = 0:
      vap = 0:
  while (not fini)
    fp = index(fmt,"%"):
    if (not(isNull(fp))) then
        ' do something with %f, %s
        select case(fp)
        case 'c':
          outs = outs & charparse(args(vap)):
        case 's':
          outs = outs & args(vap):
        ' and so on.  Quite incomplete but you get the idea.
        end select
        vap = vap + 1
    end if
  wend
end sub

printf("%s %d\n",array("Hello World", 42)):

```