几何类(父类)
#ifndef GeometricObject_hpp
#define GeometricObject_hpp
#include <stdio.h>
#include <string>
using namespace::std;
class GeometricObject{
protected:
GeometricObject();
GeometricObject(const string& color,bool filled);
public:
string getColor();
void setColor(const string& color);
bool isFilled();
void setFilled(bool filled);
virtual string toString();
virtual double getArea() const = 0;
virtual double getPerimeter() const = 0;
private:
string color;
bool filled;
};
#endif /* GeometricObject_hpp */
#include "GeometricObject.hpp"
GeometricObject::GeometricObject(){
color = "white";
filled = false;
}
GeometricObject::GeometricObject(const string& color,bool filled){
setColor(color);
setFilled(filled);
}
string GeometricObject::getColor(){
return color;
}
void Geo