Jump to content
  • Advertisement
Sign in to follow this  

one class problem

This topic is 4817 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
    {
    public:
        
        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
Advertisement
It declares m_children to be a linked list of pointers to a general tree containing objects of type dataType.


class MyClass { ... };
GeneralTree<MyClass> myTree;


In the above code, I have declared myTree to be an object of type GeneralTree that contains objects of type MyClass. So, the m_children member will be a linked list of pointers to general tree contain objects of type MyClass.

Share this post


Link to post
Share on other sites

LinkedList<GeneralTree<dataType>*>
= LinkedList of GeneralTree<dataType>*
= LinkedList of pointers to GeneralTree<dataType>s
= LinkedList of pointers to GeneralTree's of dataType


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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!