Firstly, in my own defence I should point out that I'm something of a novice at C++.
Any help with the following would be gravelly appreciated.
I have a C++ class that holds an internal array of ints.
E.g:
class MyClass {
public:
....... //lots of methods here
private:
#define STACKSIZE 100
int stack[STACKSIZE];
};
I need many instances of this class, each with a different STACKSIZE. Rather than having multiple copies of this source, each with a different STACKSIZE define, I would like to somehow parametise its creation passing an argument to the compiler for STACKSIZE.
This seemed to me like a job for a C++ template. However, templates seem to be for 'types', so I can't see how to use one to solve this.
Thanks.
John Franklin