class figure
{ public:
void erease()
{
cout<<"基类擦除"<
}
virtual void draw()
{
cout<<"基类画图"<
};
class rectangle:public figure
{
public:
void draw()
{
cout<<"矩形画图"<
cout<<"*";
cout<
{ cout<<"*";
for(int j=0;j<18;j++)
cout<<" ";
cout<<"*"<
for(int i=0;i<20;i++)
cout<<"*";
cout<
}
void center()
{
erease();
draw();
}
};
class triangle:public figure
{
public:
void draw()
{
cout<<"三角形画图"<
{
cout<<"*";
for(int j=0;j<2*i;j++)
cout<<" ";
cout<<"*";
cout<
for(int i=0;i<10;i++)
cout<<"*";
cout<
void center()
{
erease();
draw();
}
};
void main()
{
rectangle a;
triangle b;
a.center ();
cout<<"现在敲击任意键擦除重新画图"<
b.center ();
}