Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!jadam From: jadam@cs.tamu.edu (James P Adam) Newsgroups: comp.lang.c++ Subject: Re: Why no renew Message-ID: <13502@helios.TAMU.EDU> Date: 20 Mar 91 06:30:50 GMT References: <1991Mar16.172814.6525@mathcs.sjsu.edu> <966@elan.Elan.COM> Sender: usenet@helios.TAMU.EDU Organization: Computer Science Department, Texas A&M University Lines: 44 Newsgroups: comp.lang.c++ Subject: Friend Functions versus Friend Classes Summary: protected vs private Expires: References: <1991Mar16.172814.6525@mathcs.sjsu.edu> <966@elan.Elan.COM> Sender: Followup-To: Distribution: Organization: Computer Science Department, Texas A&M University Keywords: >I have a question about friend functions. > [stuff deleted] >class ToDoList { > friend Boolean Manager::Reprioritize(Bug& item, int priority); > private: > ThingList *things; >}; > >class InternalPerson { >private: > ToDoList ToDo; >}; > >class Manager : public InternalPerson { >public: > Boolean Reprioritize(Bug& item, int priority); // needs to look at ToDoList >}; It's hard to tell from this outline what exactly is going on inside the Reprioritize function (which is where the problem is, I assume). If you're trying to do something with the ToDoList "ToDo" that is declared in class InternalPerson, recognize that you can't access the information in a InternalPerson::ToDo directly from class Manager, since ToDo is declared "private" inside InternalPerson. If you want access to an InternalPerson::ToDo variable from class Manager, try making ToDo "protected" inside Internal person, instead of private. If this answer is off track, My Humble Appologies (MHA). If you wind up not getting the answer you want in the next day or so, you might consider posting a larger snippet of your code, esp. the code inside the function that is giving you the problems, plus the actual error/warning messages from the compiler. Jim