X-Git-Url: https://git.llucax.com/z.facultad/75.42/euler-oo.git/blobdiff_plain/360793b55c03f1de538e606f5259bb24c23257b3..f5f954c4c6c56e3ad3bfd97f592bef84b06da90d:/figura.cpp diff --git a/figura.cpp b/figura.cpp index f228a16..1d81d9a 100644 --- a/figura.cpp +++ b/figura.cpp @@ -22,7 +22,21 @@ #endif Figura::Figura(size_t color, size_t grosor, const Punto& centro, - const char* nombre): color(color), grosor(grosor), centro(centro) { + const char* nombre): centro(centro) { + if (color > 15) { + this->color = 15; + } else if (color < 0) { + this->color = 0; + } else { + this->color = color; + } + if (grosor > 10) { + this->grosor = 10; + } else if (grosor < 1) { + this->grosor = 1; + } else { + this->grosor = grosor; + } #ifdef DEBUG std::cerr << "En constructor de Figura." << std::endl; #endif @@ -36,8 +50,9 @@ Figura::~Figura(void) { } void Figura::dibujar(std::ostream& out) const { - out << "color: " << color << ", grosor: " << grosor - << ", nombre: " << nombre << ", centro: "; + out << "color(" << color << "), grosor(" << grosor + << "), nombre(" << nombre << "), centro("; centro.dibujar(out); + out << ")"; }