c++ - Class inheritance or nested class, which is better? -


I have a problem, those classes I have, that no longer works, because I have a specialty in public, but If I inherited it in private, or preserved and second class, then it will not work, how can I do it?

  template & lt; Typename T & gt; Class BinaryNode {public: T key; Binernode & lt; T & gt; * Left; Binernode & lt; T & gt; * Right; Binernode & lt; T & gt; * Guardian; Binarynode () {} ~ Binarineode () {}};  

And this:

  template & lt; Typename T & gt; Class BinarySearchTree {Private: Binernode & lt; T & gt; * Route; Binernode & lt; T & gt; * NewNode (T key); BinaryNode & lt; T & gt; * Minimum (binary node & lt; T & gt; * node); Binernode & lt; T & gt; * Maximum (binary node & lt; T & gt; * node); BinaryNode & lt; T & gt; * Successor (Binarineod  * node); Enter zero (binary node & lt; T & gt; ** node, t key); BinaryNode & lt; T & gt; * Search (Binernode & lt; T & gt; * node, T key); Zero distance (BinaryNode & lt; T & gt; * node, T key); Zero inorderTreeWalk (BinaryNode & lt; T & gt; * node); Public: BinarySearchTree (); ~ BinarySearchTree (); Insert zero (T key); Binernode & lt; T & gt; * Search (T key); Zero distance (t key); Zero Undertworld (); BinaryNode & lt; T & gt; * Remove (BinaryNode & lt; T & gt; * node); };  

It seems that node coupled consisting of tree:

you can use to create a friendly node tree or nested class:

  class node {private: friend class tree; ...}; Square tree {...};  

or

  class tree {Private: // may be protected class node {public: ...}; };  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -