awehrmann@watcgl.waterloo.edu (August Wehrmann) (01/21/90)
To quote Lippman (p314): "A protected class member is public to the member
functions and friends of a derived class;"
With this I formed the following classes:
class DLLElement { //Base class
protected:
DLLElement *previous;
DLLElement *next;
public:
DLLElement();
};
class Element : public DLLElement //Derived class from DLLElement
{
friend class List;
int data;
public:
Element(int=0);
};
class List //Friend of Element
{
};
The problem is that I have a member function of List (a friend of Element)
that wishes to use (not modify) the protected variable "next" in the
base class DLLElement.
From the above quote I assumed that this was possible but the compiler
screams at me saying that next is protected and that my member function
within the class List cannot access it.
Is there a way to acheive what I'm trying to do here? What am I doing wrong?
Thanks
--
===============================================================================
August Wehrmann, awehrmann@watcgl{.waterloo.edu, UWaterloo.ca}
Computer Graphics Lab, Department of Computer Science, University of Waterloo
===============================================================================