Hi this isn't really a problem as there are ways around this.
I was wondering why this:
Is not allowed in C++? A constructor initalzes data members to starting values so why are you not allowed to tell the constructor I want the vector to hold 10 names and then make all the elements empty? ( "" )
GradeBook::GradeBook ( std::string name )
setName ( name );
nameList ( 10, "" ); // this is illegal
It allowed me to declare the vector as a private member and name it but the only way to do what I need in the constructor is to remove it and create it in new function like this:
This of course would work. I am not moaning I am only wondering why you cannot do such a simple thing inside a class constructor. Any help appreciated.
std::vector<std::string> nameList ( 10, "" );