有哪个高手可以帮我看看这个程序哪里有问题吗?谢谢
#include<iostream>using namespace std;
class shape
{
public:
shape(){}
~shape(){}
virtual float GetArea(){return -1;}
};
class Rectangle:public shape
{
public:
Rectangle(int len,int wid){};
~Rectangle(){};
virtual float GetArea(){return len*wid;}
private:
int wid;
int len;
};
void main()
{
shape *sp;
sp = new Rectangle(2,3);
cout<<"the area of the rectangle is"<<sp->GetArea()<<endl;
delete sp;
}