C++ Function Issue
<p>A while ago I was given the task of converting a Java program to C++.</p>

<p>I've done this, and I've started encountering some odd errors that don't seem to make any sense to me.</p>

<p>The program consists of three files. A main.ccp, a date.ccp and a date.h.</p>

<p><strong>main.ccp</strong></p>

<pre><code>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;

#include "Date.h"

using namespace ::std;

string weekday(Date date);

int main() {

    int day, month, year;

    cout &lt;&lt; "What date (d m y)? ";

    cin &gt;&gt; day &gt;&gt; month &gt;&gt; year;

    Date event = Date(day, month, year);
    cout &lt;&lt; ("That was a " + weekday(event));
    return 0;
}

string weekday(Date date) {
    const string days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
        "Thursday", "Friday", "Saturday"};

    Date trial = Date(1, 1, 1);
    int weekday = 6;

    if (Date::precedes(trial)) {
        return "Mysteryday";
    } else {
        while (trial.precedes(date)) {
            trial.advance();
            weekday = (weekday + 1) % 7;
        }
        return days[weekday];
    }
}
</code></pre>

<p><strong>Date.ccp</strong></p>

<pre><code>#include "Date.h"

Date::Date(int day, int month, int year) {
        day_ = day;
        month_ = month;
        year_ = year;
    }

    int Date::getDay () {
        return day_;
    }

    void Date::setDay (int day) {
        day_ = day;
    }

    int Date::getMonth () {
        return month_;
    }

    void Date::setMonth (int month) {
        month_ = month;
    }

    int Date::getYear () {
        return year_;
    }

    void Date::setYear (int year) {
        year_ = year;
    }

    bool Date::isLeapYear () {

        bool lear = false;

        if (this-&gt;year_ &lt;= 1752) {
            if (this-&gt;year_ % 4 == 0) {
                lear = true;
            }
        }
        else {
            lear = false;
        }
        if (this-&gt;year_ &gt; 1752) {
            if (this-&gt;year_ % 4 == 0 &amp;&amp; this-&gt;year_ % 100 != 0) {
                lear = true;
            }
            else if (this-&gt;year_ % 4 == 0 &amp;&amp; this-&gt;year_ % 100 == 0 &amp;&amp; this-&gt;year_ % 400 == 0) {
                lear = true;
            }
            else {
                lear = false;
            }
        }
        return lear;
    }

    int Date::daysInMonth () {
        // "30 days hath September ... "
        switch (this-&gt;month_) {
        case 9 :
        case 4 :
        case 6 :
        case 11 :
            return 30;
        default :
            return 31;
        case 2 :
            return this-&gt;isLeapYear() ? 29 : 28;
        }
    }

    void Date::advance () {
        this-&gt;day_;

        if (this-&gt;day_ == 3 &amp;&amp; this-&gt;month_ == 9 &amp;&amp; this-&gt;year_ == 1752) {
            day_ = 14;
            month_ = 9;
            year_ = 1752;
        }

        if (this-&gt;day_ &gt; this-&gt;daysInMonth()) {
            this-&gt;day_ = 1;
            this-&gt;month_++;
        }
        if (this-&gt;month_ &gt; 12) {
            this-&gt;month_ = 1;
            this-&gt;year_++;

        }
    }

   bool Date::precedes (Date date) {
        return this-&gt;year_ &lt; date-&gt;year_
            || this-&gt;year_ == date-&gt;year_ &amp;&amp; this-&gt;month_ &lt; date-&gt;month_
            || this-&gt;year_ == date-&gt;year_ &amp;&amp; this-&gt;month_ == date-&gt;month_ &amp;&amp; this-&gt;day_ &lt; date-&gt;day_;
    }
</code></pre>

<p><strong>Date.h</strong></p>

<pre><code>#ifndef DATE_H
#define DATE_H

class Date {
public:
    Date (int day, int month, int year);
    int getDay();
    void setDay();
    int getMonth();
    void setMonth();
    int getYear();
    void setYear();
    bool isLeapYear();
    int daysInMonth();
    void advance();
    bool precedes(Date date);

private:
        int day_;
        int month_;
        int year_;
};

#endif  /* DATE_H */
</code></pre>

<p>I seem to be getting lots of the same errors when I compile.</p>

<p>Date.cpp:97:95: error: base operand of ‘->’ has non-pointer type ‘Date’</p>

<p>I'm not sure if I've done the declaration right or not.</p>
