I have a class that should look something like this:
class Family_Type1 @people = Array.new(3) @people = Policeman.new('Peter', 0) @people = Accountant.new('Paul', 0) @people = Policeman.new('Mary', 0) def initialize(*ages) for i in 0 ... @people.length @people[i].age = ages[i] end end end
I want to be able to define a bunch of classes similar to this one at runtime (define them once at startup) where the size of the array and the type assigned to each parameter is defined at runtime from an external specification file.
I sort of got it to work using evals but this is really ugly. Any better way?