- 1
- 0
- 约1.55万字
- 约 66页
- 2017-01-08 发布于湖北
- 举报
例4.6 (续一)。 #include iostream #include string using namespace std; class CPoint{ private: int X, Y; public: CPoint(int x=0, int y=0){X=x; Y=y;} CPoint(CPoint p){ X=p.X; Y=p.Y; } int GetX(){ return X; } int GetY() {return Y;} }; 例4.6 (续二)。 class CShape{ private: string Color; public: CShape(string c){Color = c;} virtual void Draw(){ cout Draw a shape. The color is Color endl; } void PrintColor(){ cout Color endl;} }; 例4.6 (续三)。 class CLine:public CShape{ private: CPoint Start; //线段的起点 CPoint End; //线段的终点 public: CLine(CPoint s, CPoint e, string c):CShape(c),Sta
原创力文档

文档评论(0)