#include "stdafx.h"
#include "iostream.h"
class Point
{
public:
Point(double i,double j){x=i;y=j;}
double Area() const{return 0.0;}
private:
double x,y;
};
class Rectangle:public Point
{
public:
Rectangle(double i,double j,double k,double l);
double Area()const{return w*h;}
private:
double w,h;
}
Rectangle::Rectangle(double i,double j,double k,double l):Point(i,j)
{
w=k;
h=l;
}
void fun(Point &s)
{
cout<<s.Area()<<endl;
}
void main()
{
Rectangle rec(3.0, 5.2, 15.0, 25.0);
fun(rec);
}
调试的错误是
C:\Program Files\Microsoft Visual Studio\MyProjects\lanshulin31\lanshulin31.cpp(22) : error C2533: 'Rectangle::Rectangle' : constructors not allowed a return type
C:\Program Files\Microsoft Visual Studio\MyProjects\lanshulin31\lanshulin31.cpp(33) : error C2264: 'Rectangle::Rectangle' : error in function definition or declaration; function not called
这是什么错误啊,高手指教
[转载][求助]