Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Date {
- private:
- int day;
- int month;
- int year;
- public:
- Date();
- Date(int, int, int);
- Date(const Date&);
- ~Date() = default;
- bool operator ==(const Date object) {
- return ((this->day == object.day) && (this->month == object.month) && (this->year == object.year));
- }
- void ReportDate(Date object1, Date object2) {
- bool result = object1 == object2;
- if (result == 1) {
- cout << "Дати спiвпадають!";
- }
- else {
- cout << "Дати не спiвпадають!";
- }
- }
- };
- Date::Date() {
- day = 1;
- month = 1;
- year = 2000;
- }
- Date::Date(int day, int month, int year) {
- this->day = day;
- this->month = month;
- this->year = year;
- }
- Date::Date(const Date& object) {
- this->day = object.day;
- this->month = object.month;
- this->year = object.year;
- }
- int main() {
- setlocale(0, "");
- Date d;
- d.ReportDate(Date(26, 05, 2022), Date(26, 06, 2022));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment