diff options
Added my work from today's exam
1 files changed, 15 insertions, 0 deletions
| -rw-r--r-- | Year 1/Object-oriented Programming/Exam 2/ex2/SimpleEvent.cpp | 15 |
diff --git a/Year 1/Object-oriented Programming/Exam 2/ex2/SimpleEvent.cpp b/Year 1/Object-oriented Programming/Exam 2/ex2/SimpleEvent.cpp new file mode 100644 index 0000000..bca2bdf --- /dev/null +++ b/Year 1/Object-oriented Programming/Exam 2/ex2/SimpleEvent.cpp @@ -0,0 +1,15 @@ +#include "SimpleEvent.h" +#include <iostream> + +SimpleEvent::SimpleEvent(unsigned startTime, unsigned endTime) : Event(0, 0) { + if (endTime - startTime <= 120) { + Event::setStartTime(startTime); + Event::setEndTime(endTime); + } + else + std::cout << "Event cannot last for more than 2 hours (120 minutes)!" << std::endl; +} + +SimpleEvent* SimpleEvent::clone() const { + return new SimpleEvent(*this); +} |
