ERRORs: names the constructor not the type & can't resolve address of overloaded function !!!

Hello experts,

How r u ? Kindly, I've a problem regarding the default constructors (as I believe). The errors which I get are:

1) ‘CElement::CElement’ names the constructor, not the type
2) statement cannot resolve address of overloaded function
3) make: *** [src/5_XML_Parser.o] Error 1


I've created the class diagram & sequence diagram using Borland together, then I've copied the generated header files into eclipse, then started to implement the abstract's constructor with cout statemnet as a test, the code ...

** Please, any suggestions, help or recommendation for solving these errors is very appreciated ?

** Also, a quick question: is it mandatory to create CNode.cpp for the CNode.h (the base class) ?? ... [I've already created it "CNode.cpp"]


Thank you in advance :)




/*******************************************CODE**************************/

/****************************************** Main *************************/
#include <iostream>
#include <string>
#include "CElement.h"
//#include <stdlib.h>
//#include "CNode.h"

using namespace std;

int main() {
//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

cout << "Program is Loading ... ..." << endl;
//MyClass * p1 = new MyClass; == A* a1 = new A();
//CElement elemnetObject = new CElement();
CElement::CElement elemnetObject;


return 0;
}



/****************************************** CElement.cpp ******************/
// System Headers
#include <string>
#include <iostream>
#include <stdlib.h>

using namespace std;

// Own Headers
// Implementation
#include "CElement.h"
#include "CNode.h"


CElement::CElement() : m_contentNodes(0), m_tag("")
{
cout << "CElement object " << this << ", has been instantiated." << endl;
}

CElement::~CElement()
{
// Todo: think later how to destruct
}

/*
bool CElement::addToContent(CNode* child){}
bool CElement::parseStartOrEndTag(const string& input, unsigned & parsePosition, bool & isStartTag, string& tag){}

void CElement::print(int indent){}
bool CElement::parseInput(const string& input, unsigned & parsePosition){}
node_t CElement::getNodeType(){}
*/




/************************************** CText.cpp *************************/
// System Headers

#include <string>
#include <string>
#include <iostream>
#include <stdlib.h>

// Own Headers
// Implementation
#include "CText.h"

using namespace std;

CText::CText(){}

/*
string CText::getText(){}
void CText::setText(string text){}
bool CText::parseInput(const string& input, unsigned & parsePosition){}
void CText::print(int indent){}
node_t CText::getNodeType(){}
*/




/**************************************** CNode.h *************************/
// That is CNode.h file which will be inherited
#ifndef CNODE_H
#define CNODE_H

#include <iostream>
#include <stdlib.h>
#include <string>

enum node_t {CElement,CText}; // CElement == Top Level & CText ==content with its text

class CNode {
public:

CNode();

node_t getNodeType();

~CNode();
};
/********************
** CLASS END
*********************/
#endif /* CNODE_H */
Last edited on
1) ‘CElement::CElement’ names the constructor, not the type
1
2
3
4
int main()
{
  CElement::CElement elemnetObject; // error 1
}

Compiler expects a typename before the name of variable. CElement should be a typename in this context.

However, you do define an enum with valuename CElement too. That is an unnecessary ambiguity.
@Keskiverto:

Thanks a lot, that works well :D I'm grateful for u

** The modification I did is: changing the names of enum's elements...

Tschüss
Last edited on
Topic archived. No new replies allowed.