title: VBScript nested class data structure
body: <p>My problem can be illustrated in the following example code, which sets up a data array of friends, each of which can have several phone numbers:</p>
  
  <pre><code>Class clsPhoneNo
    Dim strType
    Dim strNumber
  End Class
  
  Class clsPerson
    Dim strName
    Dim aclsPhoneNo()
  End Class
  
  Dim clsFriends()
  ReDim clsFriends(3)
  Set clsFriend(0) = New Person
  clsFriend(0).strName = "Fred"
  Set clsFriends(0).aclsPhoneNo(0) = New clsPhoneNo
  ReDim clsFriend(0).aclsPhoneNo(2)
  Set clsFriend(0).aclsPhoneNo(0).strType = "Home"
  Set clsFriend(0).aclsPhoneNo(0) = "01234567890"
  Set clsFriend(0).aclsPhoneNo(1).strType = "Work"
  Set clsFriend(0).aclsPhoneNo(1) = "09876543210"
  </code></pre>
  
  <p>However, VBScript says </p>
  
  <pre><code>Microsoft VBScript compilation error: Expected end of statement
  </code></pre>
  
  <p>Before the . on the second ReDim statement</p>
  
  <p>I need to have the aclsPhoneNo element variable length as my code isn't really an address book, but this is a simple example demonstrating the issue.</p>
  
  <p>Any ideas?</p>