class Point{
public:
Point(int xx,int yy){
x = xx;
y = yy;
}
private:
int x,y;
};
class Triangle:public Point{
public:
Triangle(Point p1,Point p2,Point p3):p1(p1),p2(p2),p3(p3){}
}
private:
Point p1;
Point p2;
Point p3;
};
上面两个类的定义在两个头文件中,在main函数中包括
#include
#include
#include "Point.h"
#include "triangle.h"
using namespace std;
int main(){
Point point(7, 11);
Point p1(1,1), p2(5,1), p3(1,4);
Triangle triangle(p1, p2, p3);
system("pause");
return 0;
}
错误是:triangle.h [Error] no matching function for call to 'Point::Point()'
这是什么原因?