Pure virtual functions

Every functions defined in the CTime CDate and CDateTime but I still get a C2259 error when i try to make a CDateTime object in main.

namespace MRDateTime
{
class Comparable
{
public:
virtual bool operator==(const Comparable &other)const = 0;

virtual bool operator!=(const Comparable &other)const = 0;

virtual bool operator<(const Comparable &other)const = 0;

virtual bool operator<=(const Comparable &other)const = 0;

virtual bool operator>(const Comparable &other)const = 0;

virtual bool operator>=(const Comparable &other)const = 0;

virtual void input(istream& sin) = 0;

virtual void print(ostream& sout) const = 0;

};
}
namespace MRDateTime
{
static const short HOURS_IN_DAY = 24;
static const short MIN_SEC = 60;

class CTime: virtual public Comparable
{
public:
CTime() {setCurrentTime();};
CTime(short hour, short minute = 0, short second = 0);

short getHour() const {return mHour;};
short getMinute() const {return mMinute;};
short getSecond() const {return mSecond;};

virtual bool operator==(const CTime &time) const;
virtual bool operator!=(const CTime &time) const;
virtual bool operator<(const CTime &time) const;
virtual bool operator<=(const CTime &time) const;
virtual bool operator>(const CTime &time) const;
virtual bool operator>=(const CTime &time) const;

virtual void print(ostream &sout) const;
virtual void input(istream &sin);

void setCurrentTime();

protected:
short mHour;
short mMinute;
short mSecond;

};

ostream& operator<<(ostream& sout, const CTime& time);
istream& operator>>(istream& sin, CTime& time);
}
namespace MRDateTime
{
static const unsigned int FIRSTYEAR = 1760;
static const CDay STARTDAY = TUESDAY;
static const unsigned int TOTALMONTHS = 12;
static const unsigned int TOTALWEEKDAYS = 7;
static const unsigned int TOTALYEARDAYS = 365;

class CDate: virtual public Comparable
{
public:
CDate(short dayOfMth = 1, CMonth month = JANUARY, short year = 1760);


virtual bool operator==(const CDate &date) const;
virtual bool operator!=(const CDate &date) const;
virtual bool operator<(const CDate &date) const;
virtual bool operator<=(const CDate &date) const;
virtual bool operator>(const CDate &date) const;
virtual bool operator>=(const CDate &date) const;

virtual void print(ostream& sout) const;
virtual void input(istream& sin);

static bool isLeapYear(unsigned int year);
static short daysInMth(CMonth &month, short year); //if february and leap year return 29
static string monthNames(short month);
static string dayNames(short day);

CDate yesterday();
CDate tomorrow();

void setCurrentDate();
unsigned int getYear() const {return mYear;};
short getDayOfMth() const {return mDayOfMth;};
CDay getDayOfWk() const {return mDayOfWk;};
CMonth getMonth() const {return mMonth;};
short getDayOfYear() const {return mDayOfYear;};

void setYear(int year) {mYear = year;};
void setDayOfMth(short day) {mDayOfMth = day;};
void setMonth(CMonth &month) {mMonth = month;};



protected:
unsigned int mYear;
short mDayOfMth;
CDay mDayOfWk;
CMonth mMonth;
short mDayOfYear;
private:
static short countLeaps(short year);

void setDayOfYear(short year, CMonth month, short dayOfMonth);
void setDayOfYear(short day) {mDayOfYear = day;};
void setDayOfWeek(short year);
void setDayOfWk(CDay &day) {mDayOfWk = day;};

};

ostream& operator<<(ostream& sout, const CDate& date);
istream& operator>>(istream& sin, CDate& date);
}
namespace MRDateTime
{

class CDateTime: public CDate, public CTime
{
public:
CDateTime() {setCurrentDate(); setCurrentTime();};
CDateTime(const CDate& date, const CTime& time)
:CDate(getDayOfMth(), getMonth(), getYear()), CTime(getHour(), getMinute(), getSecond()) {};
CDateTime(short dayOfMonth, CMonth month = JANUARY, short year= 0, short hour = 0, short minute = 0, short second = 0)
:CDate(dayOfMonth, month, year), CTime(hour, minute, second) {};


virtual void print(ostream& sout) const;
virtual void input(istream& sin);

virtual bool operator==(const CDateTime &dateTime) const;
virtual bool operator!=(const CDateTime &dateTime) const;
virtual bool operator<(const CDateTime &dateTime) const;
virtual bool operator<=(const CDateTime &dateTime) const;
virtual bool operator>(const CDateTime &dateTime) const;
virtual bool operator>=(const CDateTime &dateTime) const;


};

ostream& operator<<(ostream& sout, const CDateTime& dateTime);
istream& operator>>(istream& sin, CDateTime& dateTime);
}
code tags... sigh...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

namespace MRDateTime
{
class Comparable
{
public:
virtual bool operator==(const Comparable &other)const = 0;

virtual bool operator!=(const Comparable &other)const = 0;

virtual bool operator<(const Comparable &other)const = 0;

virtual bool operator<=(const Comparable &other)const = 0;

virtual bool operator>(const Comparable &other)const = 0;

virtual bool operator>=(const Comparable &other)const = 0;

virtual void input(istream& sin) = 0;

virtual void print(ostream& sout) const = 0;

};
}
namespace MRDateTime
{
static const short HOURS_IN_DAY = 24;
static const short MIN_SEC = 60;

class CTime: virtual public Comparable
{
public:
CTime() {setCurrentTime();};
CTime(short hour, short minute = 0, short second = 0);

short getHour() const {return mHour;};
short getMinute() const {return mMinute;};
short getSecond() const {return mSecond;};

virtual bool operator==(const CTime &time) const;
virtual bool operator!=(const CTime &time) const;
virtual bool operator<(const CTime &time) const;
virtual bool operator<=(const CTime &time) const;
virtual bool operator>(const CTime &time) const;
virtual bool operator>=(const CTime &time) const;

virtual void print(ostream &sout) const;
virtual void input(istream &sin);

void setCurrentTime();

protected:
short mHour;
short mMinute;
short mSecond;

};

ostream& operator<<(ostream& sout, const CTime& time);
istream& operator>>(istream& sin, CTime& time);
}
namespace MRDateTime
{
static const unsigned int FIRSTYEAR = 1760;
static const CDay STARTDAY = TUESDAY;
static const unsigned int TOTALMONTHS = 12;
static const unsigned int TOTALWEEKDAYS = 7;
static const unsigned int TOTALYEARDAYS = 365;

class CDate: virtual public Comparable
{
public: 
CDate(short dayOfMth = 1, CMonth month = JANUARY, short year = 1760);


virtual bool operator==(const CDate &date) const;
virtual bool operator!=(const CDate &date) const;
virtual bool operator<(const CDate &date) const;
virtual bool operator<=(const CDate &date) const;
virtual bool operator>(const CDate &date) const;
virtual bool operator>=(const CDate &date) const;

virtual void print(ostream& sout) const;
virtual void input(istream& sin);

static bool isLeapYear(unsigned int year);
static short daysInMth(CMonth &month, short year); //if february and leap year return 29
static string monthNames(short month);
static string dayNames(short day);

CDate yesterday();
CDate tomorrow();

void setCurrentDate();
unsigned int getYear() const {return mYear;};
short getDayOfMth() const {return mDayOfMth;};
CDay getDayOfWk() const {return mDayOfWk;};
CMonth getMonth() const {return mMonth;};
short getDayOfYear() const {return mDayOfYear;};

void setYear(int year) {mYear = year;};
void setDayOfMth(short day) {mDayOfMth = day;};
void setMonth(CMonth &month) {mMonth = month;};



protected:
unsigned int mYear;
short mDayOfMth;
CDay mDayOfWk;
CMonth mMonth;
short mDayOfYear;
private:
static short countLeaps(short year);

void setDayOfYear(short year, CMonth month, short dayOfMonth);
void setDayOfYear(short day) {mDayOfYear = day;};
void setDayOfWeek(short year);
void setDayOfWk(CDay &day) {mDayOfWk = day;};

};

ostream& operator<<(ostream& sout, const CDate& date);
istream& operator>>(istream& sin, CDate& date);
}
namespace MRDateTime
{

class CDateTime: public CDate, public CTime
{
public:
CDateTime() {setCurrentDate(); setCurrentTime();};
CDateTime(const CDate& date, const CTime& time)
:CDate(getDayOfMth(), getMonth(), getYear()), CTime(getHour(), getMinute(), getSecond()) {};
CDateTime(short dayOfMonth, CMonth month = JANUARY, short year= 0, short hour = 0, short minute = 0, short second = 0)
:CDate(dayOfMonth, month, year), CTime(hour, minute, second) {};


virtual void print(ostream& sout) const;
virtual void input(istream& sin);

virtual bool operator==(const CDateTime &dateTime) const;
virtual bool operator!=(const CDateTime &dateTime) const;
virtual bool operator<(const CDateTime &dateTime) const;
virtual bool operator<=(const CDateTime &dateTime) const;
virtual bool operator>(const CDateTime &dateTime) const;
virtual bool operator>=(const CDateTime &dateTime) const;


};

ostream& operator<<(ostream& sout, const CDateTime& dateTime);
istream& operator>>(istream& sin, CDateTime& dateTime);
}

indentation wouldnt hurt the chances of you getting a reply either =P just saying..
Topic archived. No new replies allowed.