Constructors and member functions

You are provided with a class definition for a class called Date, used to store calendar dates (see below). Certain functionality for output and equality testing has already been provided for you. Write implementations for the two constructors and the other four member functions which are declared but not implemented.

Can someone explain how to being coding the other constructors? What needs a constructor in this line of code?

Also what are the four member functions that need to be declared?

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
#include <iostream>
using namespace std;


class Date {

    int year;
    int month;
    int day;

    public:
    
    Date() {year=2000; month=1; day=1;}
    Date(int y, int m, int d);
    
    bool is_valid(); // Does the Date object represent a real date (year, month, day assignment)? 
    bool is_leapyear(); // Is the year a leap year?
    Date next(); // Returns a new Date object representing the next day.
    int days_until(Date other); // a.days_until(b) returns the amount of time in days between a and b.
    
    bool operator==(Date right) {
        return ((year == right.year) && (month == right.month) && (day == right.day));
    }

    friend ostream& operator<<(ostream& out, Date d);

};


ostream& operator<<(ostream& out, Date d) {
    out << d.month << "/" << d.day << "/" << d.year;
}



    
    

int main() {

    // Test Code: uncomment as you implement your member functions.

    /*
    Date today(2014, 5, 31);
    cout << "\"Today\" is " << today << endl;
    
    cout << "\"Tomorrow\" is " << today.next() << endl;
    
    int m, d, y;
    cout << "Enter Birthday (MM DD YYYY): ";
    cin >> m >> d >> y;
    
    Date birthday(y, m, d);
    
    cout << "You were born ";
    cout << birthday.days_until(today);
    cout << " days ago." << endl;
    */
}


I appreciate you reading this and offering any insight! Have a nice day!
Anyone out there?
Start with this:
http://www.cplusplus.com/doc/tutorial/classes/

You should be able to use that tutorial to figure out what methods and constructors aren't defined. If you have further questions feel free to ask.
Topic archived. No new replies allowed.