Or at least I think that's the issue. Essentially, I am in the process of overloading operators and allowing users to enter data directly into the class objects. I was able to do the first one so I followed the same pattern and I get a segmentation fault when I try to cin >> the information. Everything else about the program operates as it should, so I'll post what I think are the relevant pieces of code:
appointment.h:
class Appointment
{
Time startTime;
Time endTime;
char *subject;
char *location;
friend ostream &operator<<( ostream &, const Appointment & );
friend istream &operator>>( istream &, Appointment & );
public:
Appointment();
Appointment(const char* subject);
~Appointment();
void read();
Appointment& operator= (const Appointment &a);
bool operator== (const char *s) const;
void makeAppt();
}; // class Appointment
appointment.cpp:
void Appointment::makeAppt()
{
cout << "Subject >> ";
cin >> inputAppt;
}
istream &operator>>( istream &input, Appointment &appt )
{
input >> appt.subject;
return input;
}
Appointment::Appointment() : subject(NULL), location(NULL)
{
}
Thanks for taking a look.
Edit: Added in Appointment constructor.