C++ Protected Class Members are Private???

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Feb 20 10:12:00 GMT 2003


Neil Booth <neil@daikokuya.co.uk> writes:

| Mongryong wrote:-
| 
| >     // now, this generates a compiler error!!!
| >     // right->left: left is protected and can't be accessed??
| >     left = right->left;
| 
| left = this->left is OK, but not right->left because it's a different
| object.  At least, that's my understanding.  Welcome to C++.

Your understanding is correct.  BinaryTree didn't grant friendship to
AVLTree, therefore any direct access to a BinaryTree member from an
AVLTree member function  is invalid.

-- Gaby



More information about the Gcc mailing list