最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
例程实作 ----庖丁解羊(下)(转)
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
----庖丁解羊(下)
#include
#include
using namespace std;
class Part{
public:
virtual void Draw()=0;
virtual ~Part(){}
};
class Shape{
public:
Shape( string const& _s ):data( _s ){}
void Draw( unsigned color )
{
cout << data << " with color :" << hex << color << endl;
} //提供了借口,但是没有实现绘图
private:
string data;
//读者可以自己实现绘图部分
};
//绒毛,骨架,胸,腹,背,眼睛,鼻子,嘴巴,心,脾,肝,肠,肾,脚,尾巴,耳朵,肺,胃{{部分,显示=轮廓+颜色},轮廓[1],颜色[1]}
class BasePart : public Part{
public:
BasePart( string const& _s , unsigned _c ):shape( _s ),color( _c ){}
void Draw()
{
shape.Draw( color );
}
private:
Shape shape;
-
上一个: 例程实作 ----庖丁解羊(上)(转)
-
下一个: OOP的未来(转)
相关文章
- PS制作旋转八卦图教程 07-27
- java中如何使用BufferedImage判断图像通道顺序并转RGB/BGR 07-25
- PPT如何制作一段月球围绕地球转的动画 07-06
- 微软裁员为了什么 补充新鲜血液向云计算服务公司转型 07-05
- 天龙八部手游门派转职详解 转职天龙注意事项 07-03
- 龙之谷手游刺客转职加点如何选 06-27