正在加载图片...
第7章继承与派生 例7.1(续 class CPoint: public CLocation∥从 LOcation中公有继承 private char Color[10] public CPoint(char*c) void setcolor(char *c) void showo CPoint:: C Point(char*c) strcpy( color, c) void CPoint: Setcolor(char *c) 调用从 CLocation类中继承来的成 员函数GeO和GetY(。 strcpy( color, c) void CPoint: Showo cout < Getxo <<, <<Gety( <<<< Color < endl例7.1 (续二) class CPoint : public CLocation //从CLocation中公有继承 { private: char Color[10]; public: CPoint(char *c); void SetColor(char *c); void Show(); }; CPoint::CPoint(char *c) { strcpy(Color,c); } void CPoint::SetColor(char *c) { strcpy(Color,c); } void CPoint::Show() { cout << Getx() << "," << Gety() << " " << Color << endl ; } 第7章 继承与派生 调用从CLocation类中继承来的成 员函数GetX()和GetY()
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有