-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReminder.cpp
More file actions
50 lines (49 loc) · 1.58 KB
/
Reminder.cpp
File metadata and controls
50 lines (49 loc) · 1.58 KB
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
//
// Created by seraf on 16.03.2021.
//
#include "Reminder.h"
Reminder::Reminder(std::string message, DateTime time, bool important): message(message), remindTime(time), isImportant(important){}
Reminder::Reminder(const Reminder& R): message(R.message), remindTime(R.remindTime), isImportant(R.isImportant){
this->message = R.message;
this->remindTime = R.remindTime;
this->isImportant = R.isImportant;
}
Reminder::~Reminder(){}
Reminder& Reminder::operator=(const Reminder& R){
if( &R != this ){
this->message = R.message;
this->remindTime = R.remindTime;
this->isImportant = R.isImportant;
}
return *this;
}
std::ostream& operator<<(std::ostream& out, const Reminder &R){
out << R.message << "\n";
R.remindTime.printDate(std::cout);
return out;
}
void Reminder::print(std::ostream& os){
os<<"Reminder!\n";
os << *this << "\n";
}
void Reminder::delay(){
this -> remindTime.addMinutes(10);
}
void Reminder::setMessage(std::string msg){
this -> message = msg;
}
void Reminder::setDate(DateTime timeChange){
this -> remindTime = timeChange;
}
void Reminder::setImportant(bool important){
this -> isImportant = important;
}
std::string Reminder::getMessage() const{
return this -> message;
}
DateTime Reminder::getDate() {
return this -> remindTime;
}
std::unique_ptr <Reminder> Reminder::clone(){
return std::make_unique<Reminder>(*this);
}