I am trying to create a header file for a Patient class. Where I am having trouble in the first place is creating the default constructor. Whenever I put the Date private member(from a different header file that has Date and three private variables that include a day, month, and year numbers) I get an error saying "Default argument not at end of parameter list". Am i declaring that part wrong?
#ifndef PATIENT1_H
#define PATIENT1_H
#include <iostream>
#include "date.h"
#include <string>
usingnamespace std;
class Patient{
struct procedure{
Date dateOfProcedure;
int procedureID;
int procedureProviderID;
};
public:
Patient(int id = 0, constchar* fn = "John", constchar* ln = "Doe", Date bday ); //Put in default values
// just as in Date class
//Use the set functions so input values are checked
~Patient();
Patient & setID(int);
Patient & setFirstName(constchar *); //check if length of name string is < 15
Patient & setLastName(constchar *); //check if length of name string is < 15
Patient & setBirthDate(Date);
Patient & setPrimaryDoctorID(int);
int getID();
constchar * getFirstName();
constchar * getLastName();
Date getBirthDate();
int getPrimaryDoctorID();
bool enterProcedure(Date procedureDate, int procedureID, int procedureProviderID);
void printAllProcedures();
private:
int ID;
char firstName[15];
char lastName[15];
Date birthdate;
int primaryDoctorID; //Add
procedure record[500];
int currentCountOfProcedures;
};
#endif
In the Date class header the default constructor looks like this
It's complaining because bday doesn't have a default argument. It would be useless to have default arguments if the last one didn't have one because there is no way you can leave out the middle arguments without leaving out the last argument, but you can't leave out the last argument if it doesn't have a default argument.