Computer Science Canada

flexible array of a class?

Author:  gg900 [ Sat Mar 08, 2008 10:24 pm ]
Post subject:  flexible array of a class?

how would I resize a flexible array of a class. they both use 'new' in a differnt way.

Author:  Saad [ Sat Mar 08, 2008 10:40 pm ]
Post subject:  RE:flexible array of a class?

Turing:
class Foo
    %% The class
end Foo

var bar : flexible array 1 .. 10 of ^Foo  %% Create an array of Foo pointers
for i : 1 .. 10
    new bar (i)  %% Create 5 Foo's
end for

for i : 5 .. 10
    free bar (i)  %% Free the Foo's before we resize the array
end for
new bar, 4  %% Change array Size


: