代码如下,为何会有3个错误
// ConsoleApplication68.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include
using namespace std;
const double PI = 3.14;
class Shape {
public:
virtual void getArea() = 0;
virtual void getPerim() = 0;
};
class Rectangle :public Shape {
private:
double width;
double length;
public:
Rectangle():width(0),length(0){}
Rectangle(double width,double length):width(width),length(length){}
virtual void getArea() {
cout << "Area:" << width*length << endl;
}
virtual void getPerim() {
cout << "Perim:" << 2 * (width*length) << endl;
}
~Rectangle();
};
class Circle: public Shape{
private:
double radius;
public:
Circle():radius(0){}
Circle(double radius):radius(radius){}
virtual void getArea() {
cout << "Area:" << PI*radius*radius;
}
virtual void getPerim() {
cout << "Perim:" << 2 * PI*radius;
}
~Circle();
};
int main()
{
Rectangle a1(2, 3);
Circle c1(2);
a1.getArea();
a1.getPerim();
c1.getArea();
c1.getPerim();
return 0;
}