I'm very very new to c++.I'm truing to built a program to make new appointment etc.
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Appointment;
class MyDate
{
private:
string date;
string hour;
public:
MyDate();//constructor xoris parametrous//
void set_date(string _date)
{
date=_date;
}
void set_hour(string _hour)
{
hour=_hour;
}
friend void print(Appointment &,MyDate &) ;
friend class Scedule;
};
class Appointment
{
private:
string description;
string date;
string hour;
public:
Appointment();//constructor xoris parametrous//
void set_description(string _description)
{
description=_description;
}
friend class MyDate;
friend class Scedule;
friend void print(Appointment &, MyDate &);
};
void print(Appointment &a,MyDate &d)
{
cout<<"description of appointment "<<a.description<<endl;
cout<<"date "<<d.date<<" hour "<<d.hour<<endl;
}
class Scedule
{
vector<Appointment> m_apps;
public:
void addAppointment(Appointment const & app)
{
m_apps.push_back(app);
}
friend class Appointment;
friend class MyDate;
};
int main(int argc, char *argv[])
{
Appointment app;
MyDate dt;
string tmpDesc;
string tmpDate;
string tmpHour;
cout<<"Give description of appointment ";
cin>>tmpDesc;
cout<<"Give date of appointment ";
cin>>tmpDate;
cout<<"Give hour of appointment ";
cin>>tmpHour;
app.set_description(tmpDesc);
dt.set_date(tmpDate);
dt.set_hour(tmpHour);
print(app,dt);
system("pause");
return 0;
}
the error is [Linker error] undefined reference to `Appointment::Appointment()'
[Linker error] undefined reference to `MyDate::MyDate()'
i'm sure that i have more things to do to this code,but now i would like your help to solve this error!