Jump to content
  • Advertisement
Sign in to follow this  


This topic is 5000 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[source +"cpp"]template <class dataType>
class LinkedList
    template <class dataType>
    class listNode
        listNode<dataType>* next;       

template <class dataType>
class GeneralTree

{    dataType m_data;
   LinkedList<GeneralTree<dataType>*> m_children;

Õâ¸öLinkedList<GeneralTree<dataType>*> m_children; what does this sentence mean??

Share this post

Link to post
Share on other sites
This means the general tree class stores internally a list of its children.
Its children are represented by a linked list of pointers to general tree classes.
The name GeneralTree is here misleading and the name of the templated class adds to confusion. The GeneralTree class here represents a leaf of the tree and stores internally a linked list of pointers to the children leaves of the tree.

If you declare an Int tree (or an Ent ;) ), you have:

//tree declaration
GeneralTree<Int> MyTree
//internal children representation
LinkedList< GeneralTree<int>* > m_children;

Hope that clarifies.
Ghostly yours,

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!