전공 공부/C++
클래스 Oval, Rect, Triangular
#include #include using namespace std; class Shape { protected: string name; int width, height; public: Shape(string n = "", int w = 0, int h = 0) { name = n; width = w; height = h; } virtual double getArea() { return 0; } string getName() { return name; } }; class Oval :public Shape { public: Oval(string n, int w, int h) :Shape(n, w, h) {} double getArea() { return 3.14 * width * height; } }; c..
2021. 6. 16. 19:30