dev-c++ 问题 ;帮忙看看啊
错误信息:
行号:4 C:\cppprojects\4\CElement.cpp
cannot declare member function `CElement::CElement' within `CFunction'
行号:8 C:\cppprojects\4\CElement.cpp
cannot declare member function `CElement::CElement' within `CFunction'
12 C:\cppprojects\4\CElement.cpp
cannot declare member function `CElement::CElement' within `CFunction'
17 C:\cppprojects\4\CElement.cpp
cannot declare member function `CElement::CElement' within `CFunction'
.h文件
using namespace std;
#include <string>
#include <vector>
class CFunction;
class CElement{
public :
CElement();
CElement(string name);
CElement(string id,string name);
~CElement();
virtual string getContent();
void addFunction(CFunction function);
void removeFunction(CFunction function);
const string getId(){return name;};
const string getName(){return name;};
const string getDesc(){return desc;};
void setName(string name);
void setDesc(string desc);
protected:
string id;
string name;
string desc;
int kindOfValue;
vector<CFunction> functions;
public:
const static int KIND_STRING=0;
const static int KIND_CHAR=1;
const static int KIND_INTEGER=2;
const static int KIND_FLOAT=3;
const static int KIND_LONG=4;
};
.cpp文件
#include "CElement.h"
#include "CFunction.h"
CElement::CElement(string name){
CElement("id",name);
}
CElement::CElement(){
CElement("id","null");
}
CElement::CElement(string newid,string newname){
this->id=newid;
this->name=newname;
}
CElement::~CElement(){
}
void CElement::addFunction(CFunction function){
functions.push_back(function);
}
void CElement::removeFunction(CFunction function){
//functions.push_back(function);
}
string CElement::getContent(){
return id + name;
}