Question: Find the error in the code. Don't change the code in main, manipulate the class the work with the main. What needs to be changed

Find the error in the code. Don't change the code in main, manipulate the class the work with the main. What needs to be changed so the code can compile?

#include using namespace std; class Date { public: Date(int mn, int dy, int yr) : month(mn) {}; int getMonth(); void setMonth(int mn); private: int month;

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

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

int main() { const Date BirthDate(1, 18, 1953); BirthDate.getMonth(); return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!