尝试编译我的代码时,我每次都会收到以下错误。这些是错误:
C:\...\main.cpp In file included from main.cpp
C:\...\triangle.h In constructor `trianglePlus::trianglePlus(double, double, double, char*)':
C:\...\triangle.h expected `{' at end of input
C:\...\Makefile.win [Build Error] [main.o] Error 1
这是我的程序的精简版。
三角形.h:
class triangle {
double x;
double y;
double z;
public:
triangle(double a,double b,double c);
};
class trianglePlus: public triangle {
char * name;
public:
trianglePlus(double a,double b,double c,char * v):triangle(a,b,c);
};
删除评论部分时,它给了我更多错误。主文件
#include <cstdlib>
#include <iostream>
#include <math.h>
#include "triangle.h"
using namespace std;
triangle::triangle(double a, double b, double c) {
x = a;
y = b;
z = c;
}
/*
trianglePlus::trianglePlus(double a,double b,double c,char * v):trijsturis(a,b,c) {
x = a;
y = b;
z = c;
name = new char[20];
strcpy(name,v);
}
*/
int main()
{
system("PAUSE");
return 0;
}
有什么想法可能是错的吗?