D
Dom
I need an array to be used by one method in a class. I can do this
three ways.
1. Put the array in the method. This seems like the best place,
since it is used only by the method. But it occurs to me that the
array must be initialized each time the method is called.
2. Put the array and the initialization in the class-level as a
static. (Why can't I make this a cons, BTW?). I don't like this
because I don't need it to be static or in the class-level.
3. Declare the array as a const at the class level, initialize it in
the constructor. This seems like the less-objectionable approach,
although I still have a class-wide array that is used only in a
method.
Which is the best approach, or is there something I've missed?
Dom
three ways.
1. Put the array in the method. This seems like the best place,
since it is used only by the method. But it occurs to me that the
array must be initialized each time the method is called.
2. Put the array and the initialization in the class-level as a
static. (Why can't I make this a cons, BTW?). I don't like this
because I don't need it to be static or in the class-level.
3. Declare the array as a const at the class level, initialize it in
the constructor. This seems like the less-objectionable approach,
although I still have a class-wide array that is used only in a
method.
Which is the best approach, or is there something I've missed?
Dom