求解,代码没错,却提示错误!
#include<iostream>using namespace std;
class point
{
public:
point(int i=0,int j=0){x0=i;y0=j;}
virtual void set()=0;
virtual void draw()=0;
protected:
int x0,y0;
};
class lime:public point
{
public:
line(int i=0,int j=0,int m=0,int n=0):point(i,j)
{
x1=m;y1=n;
}
void set(){cout<<"line::set()called.\n";}
void draw(){cout<<"line::draw()callede.\n";}
protected:
int x1,y1;
};
class ellipse:public point
{
public:
ellipse(int i=0,int j=0,int p=0,int q=0):point(i,j))
{
x2=p;
y2=q;
}
};
void drawobj(point *p)
{
p->draw();
}
void main()
{
line *lineobj=new line;
ellipse *elliobj=new ellipse;
drawobj(lineobj);
drawobj(elliobj);
cout<<endl;
setobj(lineobj);
setobj(elliobj);
cout<<"\nRedraw the...\n";
drawobj(lineobj);
cout<<"\nRedraw the object...\n";
drawobj(lineobj);
drawobj(elliobj);
}