kornalius
10-12-2006, 07:03 PM
Here is how to assign objects to arrays and class type on the fly, this will only work with version 1.05 and up:</p><pre><span style="color: #0066ff">#class myclass
* public(v$, x$);</span></pre><pre><span style="color: #0066ff">* public proc m
*** ShowMessage(v$ + "," + x$);
* end;</span></pre><pre></pre><pre><span style="color: #0066ff">#class myclass2
* public(v$);</span></pre><pre><span style="color: #0066ff">* public proc m
*** ShowMessage(v$);
* end;</span></pre><pre></pre><pre><span style="color: #0066ff">proc main
* dim(o$, 10);
* For (i$, 1, 5)
*** #object myclass z$;
*** o$[i$] = z$;
*** o$[i$].x$ = i$ * 2;
*** myclass2(o$[i$]).v$ = i$;* // Classtyping
* end;
* For (i$, 1, 5)
*** o$[i$].m;
*** myclass2(o$[i$]).m;* // Classtyping
* end;
end;</span></pre>
* public(v$, x$);</span></pre><pre><span style="color: #0066ff">* public proc m
*** ShowMessage(v$ + "," + x$);
* end;</span></pre><pre></pre><pre><span style="color: #0066ff">#class myclass2
* public(v$);</span></pre><pre><span style="color: #0066ff">* public proc m
*** ShowMessage(v$);
* end;</span></pre><pre></pre><pre><span style="color: #0066ff">proc main
* dim(o$, 10);
* For (i$, 1, 5)
*** #object myclass z$;
*** o$[i$] = z$;
*** o$[i$].x$ = i$ * 2;
*** myclass2(o$[i$]).v$ = i$;* // Classtyping
* end;
* For (i$, 1, 5)
*** o$[i$].m;
*** myclass2(o$[i$]).m;* // Classtyping
* end;
end;</span></pre>