Q. What is the purpose of the 'friend' function in C++?

  • (A) To allow access to private and protected members of a class
  • (B) To create multiple objects of a class
  • (C) To inherit a class
  • (D) To define a global function
πŸ’¬ Discuss
βœ… Correct Answer: (A) To allow access to private and protected members of a class
Explanation: A 'friend' function in C++ can access private and protected members of a class.
Explanation by: Admin
A 'friend' function in C++ can access private and protected members of a class.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
230
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
88%
Success Rate