c++ - accessing protected data members of another class -


I am trying to apply a red-black tree, and I have created nodes, each of which has a left child The node is, the right baby node, and a parent node, stored in my red black node class as safe data members. In my convergence ceremony, I have to use each node-protected member like my left child or his parents, using node -> _ left -> _ guardian and so on. However, my compiler complains that

  bst.h: 77: 29: error: 'node & lt; Int, int & gt; * Node & lt; Int, int & gt; :: _ left 'is protected rbbst.h: 160: 3: error: within this context bst.h: 77: 46: error:' node & lieutenant; Integer, interval & gt; * Node & lt; Int, int & gt; :: _ parent 'is protected rbbst.h: 160: 3: error: this reference inside  

How can I remove this issue?

My suggestions: 1. recode class node as a structure; 2. Add those accessible public members to the brain who return in the context of those data members and you should keep the data member as private;

Finally, sorry for my bad english. This is my first answer on this web site. (● '◡' ●)


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -