正在加载图片...
第7章继承与派生 7.2类的继承方式 7.2.1公有继承(续一) 若将基类 CLocation中的X,y改成保护成员,即 class clocation protected int x 将x,y改为保护成员后,上面的 showO Int y, 就可以直接访问成员x和y了 ublic int GetXo int Geto void Move To(int x, int y) CLocation(int X=0, int y=0)7.2 类的继承方式 7.2.1 公有继承(续一) 若将基类CLocation中的x,y改成保护成员,即: class CLocation { protected: int x; int y; public: int Getx(); int Gety(); void MoveTo(int x, int y); CLocation(int x=0, int y=0); }; 第7章 继承与派生 将x,y改为保护成员后,上面的show() 就可以直接访问成员x和y了
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有