KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: When should you use 'friend' in C++? I have come to a stumbling block because of lack of documentation on friend classes. Most books just explain it briefly, e.g an excerpt from C++: the Complete Reference : Friend Classes are seldom used. They are supported to allow certain special case situations to be handled. And frankly, I have never seen a friend class in any good code made by an experienced C++ programmer. So , here is my list of problems. Do Inherited Classes have the same friends as there base classes? e.g, if I declare class foo as a friend of class base, will class der (derived from base) also have foo as a friend? What are the special case situations when a friend class should be used? I am making a winapi wrapper in which I want to make class WinHandle a friend of class Widget (to access some protected members). Is it recommended? Or should I just access them using the traditional Get/Set functions?
Tags (comma-separated)
Save Edits
Cancel