Hello,
I am studying (and hopefully learning something,) VB Scripting and I'm currently learning about classes. I have a class with private variables V1(99) and V2(99). Within the Class_Initialize SUB routine, I initialize V1 to its correct values. (Each element in the array is an object. Each object is defined and assigned. I have verified its correctness.

Now, at the end of Class_Initialize, Ihave the statement:
V2 = V1  ' line alpha
set V2 = V1  ' line beta

It loads fine with no load errors. However, at run time, Iget the error: line alpha ... type mismatch
and also:
line beta   type mismatch.

Both V1 and V2 on on sequential lines -- that is, they are not separated by anything, not even a blank line -- no routines, no declarations -- nothing.

So, how do I copy an object containing objects within the class' declarative scope? Since these are arrays of 99 objects, do I need to run a loop to explicitly copy each object element from V1 to its corresponding location in V2? Is there no aggregate copy?

Class Aggregate

private V1(99) ' Cannot use the constant named AgSize. So much for using constants!
private V2(99)

...

sub Class_Initialize ()
...
for I = 1 to AgSize
    set V1(I) = new AggregateElementObject
next

  V2 = V1  ' line alpha and also tried
  set V2 = V1  ' get the same type mismatch error
...
end Class  ' Aggregate

Thanks for any help with this.

Dave

Reply via email to