/** Used to initialize all the member variables of the class. This function is called by each constructor. @param - firstName: string for the student's first name @param - lastName: string for the student's last name @param - gpa: double representing the student's GPA @param - crecits: the number of credits the student has */ void Student::init(string firstName, string lastName, double gpa, int credits) { setFirstName(firstName); setLastName(lastName); setGpa(gpa); setCredits(credits); }
Student::Student(const char * id, float gpa) { this->id = new char[strlen(id) + 1]; strcpy(this->id, id); if (!setGpa(gpa)) { this->gpa = 0; } }