From 3e51c41636d2cc1a6c5b6a60d806b0356d3ef9aa Mon Sep 17 00:00:00 2001 From: Holger Boerchers Date: Tue, 20 Nov 2018 22:15:02 +0100 Subject: [PATCH] removed copy constructor --- Urlaubsverwaltung/Urlaubsverwaltung.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Urlaubsverwaltung/Urlaubsverwaltung.cpp b/Urlaubsverwaltung/Urlaubsverwaltung.cpp index 48cef3d..7cbe81e 100644 --- a/Urlaubsverwaltung/Urlaubsverwaltung.cpp +++ b/Urlaubsverwaltung/Urlaubsverwaltung.cpp @@ -17,18 +17,18 @@ using namespace std; // 'ü' 81 201 // 'ß' E1 341 -class Date +class date { private: short day_; short month_; unsigned int year_; public: - Date() : day_(1), month_(1), year_(1900) + date() : day_(1), month_(1), year_(1900) { } - Date(short day, short month, unsigned int year) : day_(day), month_(month), year_(year) + date(short day, short month, unsigned int year) : day_(day), month_(month), year_(year) { } @@ -47,8 +47,8 @@ public: return std::to_string(day_) + "." + to_string(month_) + "." + to_string(year_); } - bool operator ==(const Date& d) const { return day_ == d.day_ && month_ == d.month_ && year_ == d.year_; } - bool operator !=(const Date& d) const { return !operator==(d); } + bool operator ==(const date& d) const { return day_ == d.day_ && month_ == d.month_ && year_ == d.year_; } + bool operator !=(const date& d) const { return !operator==(d); } }; class employee @@ -59,17 +59,11 @@ public: { } - employee(const employee& rhs) : name(rhs.name), first_name(rhs.first_name), day_of_birth(rhs.day_of_birth), - holidays(rhs.holidays), taken_holidays(rhs - .taken_holidays) - { - } - employee(string name, string first_name, short day, short month, unsigned int year) : name(move(name)), first_name(move(first_name)), taken_holidays(0) { - day_of_birth = Date(day, month, year); + day_of_birth = date(day, month, year); const auto age = day_of_birth.get_age(); holidays = age > 50 ? 32 : 30; } @@ -93,7 +87,7 @@ public: string name; string first_name; - Date day_of_birth; + date day_of_birth; int holidays; int taken_holidays; };