Note that there are some explanatory texts on larger screens.

plurals
  1. POTroubles with my .h files
    primarykey
    data
    text
    <p>Here are my two classes, Node and DobleNode, both of them are in a different .h file and both of them have their own .cpp file as well.</p> <pre><code>//"Node.h" class Node { public: Node(string pName, string pID); void setReferencia(DobleNode *pReferencia); DobleNode* getReferencia(void); private: string Name; string ID; DobleNode *referencia; }; //"DobleNode.h" class DobleNode { public: DobleNode(string pBank_code, string pCard_type); void setReferencia(Node *pReferencia); Node* getReferencia(void); private: string bank_code; string card_type; Node *referencia; }; </code></pre> <p>The problem is that I need to have a reference. In the class Node, there must be an attribute of type DobleNode, and in the class DobleNode there must be an attribute of type Node. It seems to be really simple, I just have to include "DobleNode.h" before "Node.h" and everything will work... </p> <p>But if I do this, later on, when I try to compile my little program it says that the identifier Node does not exist. And if I do it the other way, it says the same thing, but this time the identifier DobleNode is the one that does not exist.</p> <p>How can I solve this, I think a solution might be to have both classes in the same file, but I really think there is a better way of solving this. Is there a way to "tell" the compiler to check both "Node.h" and "DobleNode.h" at the same time, or something?</p> <p>Thanks for your answer.</p> <p>BTW I'm working on Visual Studio 2010 Proffesional, C++ (clearly).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload