How do I setup an array in C++ with a constant as the max size allowed? -


class grades { private:    char *grade;    string course[20];    int numcourse; public:    grades();    bool setgrade(char *gradein);    bool setcourse(char *namein);  }; 

so that's class declaration. want set constant number instead of 20 in array declaration. how go doing that? have tried static const problem every time class returns error saying out of scope.

this doesn't work?

class grades { private:    char *grade;    static const int max_courses = 20;    string course[max_courses];    int numcourse; public:    grades();    bool setgrade(char *gradein);    bool setcourse(char *namein);  }; 

Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -