Object Oriented Programming20795 marksFriend classes
Why do we need friend class? How can we define member function outside the class?
Why do we need friend class? How can we define member function outside the class? [5]
In C++, data members declared as private or protected are not accessible from outside the class. This enforces data encapsulation. However, sometimes it is necessary for an external class or function to access the private and protected members of another class. This is where the friend class is n...