/* * simpletask.cpp * * Created on: 30.05.2013 * Author: trifon */ #include using namespace std; #include "simpletask.h" SimpleTask::SimpleTask(char const* _name, int _time) : BaseTask(_name), total(_time), progress(0) {} void SimpleTask::print() const { cout << "Проста "; BaseTask::print(); cout << ", която е с напредък " << progress; cout << " от " << total << endl; } int SimpleTask::time() const { return total; } int SimpleTask::getProgress() const { // throw progress; return progress; } int SimpleTask::work(int t) { int remaining = total - progress; if (remaining <= t) { t -= remaining; progress = total; return t; } progress += t; return 0; } Cloneable* SimpleTask::clone() const { return new SimpleTask(*this); }