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
Post a Comment