This is not a member function returning the class unless it is called inside a member function of the class or a derived class.
Are you sure these functions return a class and not a pointer or reference to a class?
you mean
-
class vehicle
-
{
-
public:
-
vehicle fooV(){return *this}
-
vehicle(){}
-
-
}
-
-
class car : public vehicle
-
{
-
public:
-
car fooC(){return *this}
-
car(){}
-
}
-
???
This is what the base class(it is a structure, I deleted some functions) look like:
typedef struct DLLENTRY XMLNode
{
private:
struct XMLNodeDataTag;
XMLNode(struct XMLNodeDataTag *pParent, XMLCSTR lpszName, char isDeclaration);
XMLNode(struct XMLNodeDataTag *p);
public:
XMLNode getParentNode() const; // return the parent node
XMLNode getChildNode(int i=0) const; // return ith child node
private:
typedef struct XMLNodeDataTag // to allow shallow copy and "intelligent/smart" pointers (automatic delete):
{
XMLCSTR lpszName; // Element name (=NULL if root)
int nChild, // Number of child nodes
nText, // Number of text fields
nClear, // Number of Clear fields (comments)
nAttribute; // Number of attributes
char isDeclaration; // Whether node is an XML declaration - '<?xml ?>'
struct XMLNodeDataTag *pParent; // Pointer to parent element (=NULL if root)
XMLNode *pChild; // Array of child nodes
XMLCSTR *pText; // Array of text fields
XMLClear *pClear; // Array of clear fields
XMLAttribute *pAttribute; // Array of attributes
int *pOrder; // order of the child_nodes,text_fields,clear_fields
int ref_count; // for garbage collection (smart pointers)
} XMLNodeData;
XMLNodeData *d;
} XMLNode;
I need a class myXMLNode has function
myXMLNode* mygetparentNode(...)
{
XMLNode mynode = getParentNode() ; // call the base class and return base class
return static_cast<myXMLNode*>(&mynode); // return derived class pointer, if I can return the derived class that will be the best result. Is that possible?
}