Note that there are some explanatory texts on larger screens.

plurals
  1. POgraph inheritance
    primarykey
    data
    text
    <p>I have implemented the following class </p> <pre><code>class graph { friend ostream&amp; operator&lt;&lt; (ostream&amp;, graph&amp;); public: graph() { } ~graph() { clearMap(); } class node { friend ostream&amp; operator&lt;&lt; (ostream&amp;, const graph::node&amp;); public: node() { } node(const node&amp;); node(luint inID) { ID = inID; } virtual ~node() { neighbors.clear(); } node&amp; operator=(const node&amp;); void addNeighbor(luint); void addNeighbor(const std::vector&lt;luint&gt;&amp; ); luint ID; std::vector&lt;luint&gt; neighbors; }; void addNode(const node&amp;); void addNode(const node*); void addNode(luint); void readFile(const char * ); void clearMap(); void randGeom(luint, double); void connRandGeom(luint, double); bool isConnected(); protected: std::map&lt;luint, node*&gt; nodeMap; }; </code></pre> <p>and created a new one, inherited from graph</p> <pre><code>class colorGraph : public graph { public: colorGraph() { } ~colorGraph() { } class colorNode : public graph::node { public: colorNode() { } ~colorNode() { } luint color; }; }; </code></pre> <p>However, the following main program does not find the proper function:</p> <pre><code>int main() { pColorGraph myGraph; myGraph = new colorGraph(); myGraph-&gt;isConnected(); return 0; } </code></pre> <blockquote> <p>Undefined symbols:<br> "graph::isConnected()", referenced from: _main in main.o ld: symbol(s) not found collect2: ld returned 1 exit status</p> </blockquote> <p>can someone tell me what am I doing wrong?</p> <p>Thank you,</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.
 

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