2079 11

BIT153 ยท 2079 ยท 5 marks

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]

Object Oriented ProgrammingChapter 5: Function Features and Inline FunctionsFriend classes

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...