急!!!C++继承问题和友元函数

//Shape.h

enum ShapeType{Circle, Ellipse, Rectangle, Triangle, Polygon, HouseShape, Ring};

class Shape
{
public:
        Shape(ShapeType type);
        ~Shape();
        virtual double Perimeter() = 0;
        virtual double Area() = 0;

protected:
        ShapeType type;

};

//Shape.cpp

#include "Shape.h"

Shape::Shape(ShapeType type)
{
        this->type = type;
}

Shape::~Shape()
{
}

//Circle.h

#include "Shape.h"
#include <iostream>
using namespace std;

class Circle : public Shape
{
public:
        friend ostream& operator << (ostream &, Circle &);
        double Area();
        double Perimeter();
        Circle(ShapeType type);
        ~Circle();

private:
        double radius;

};

//Circle.cpp

#include "Circle.h"

const  double PI = 3.1415926;
Circle::Circle(ShapeType type): Shape(type)
{
        radius = 0.;
}

Circle::~Circle()
{
}

double Circle::Area()
{
        return PI * radius * radius;
}

double Circle:erimeter()
{
        return 2 * PI * radius;
}

//主函数

#include<iostream>
using namespace std;

//#include "Shape.h"
#include "Circle.h"


ostream& operator <<(ostream &out, Circle &c)
{
        out << "圆的半径为:" << c.radius << endl;
        out << "圆的周长为:" << c.Perimeter() << endl;
        out << "圆的面积为:" << c.Area() << endl;
        return out;
}

int main()
{
        return 0;
}

写到这,就有九个错,还有好几个类还没写呢。这到底是什么错啊?什么原因阿?
我真是一头雾水,哪位高手请指教一下,在下不胜感激。
还要交作业阿!

[ 本帖最后由 lianfeng0421 于 2007-5-26 20:07 编辑 ]
我也来说两句 查看全部回复

最新回复