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

πŸ‘οΈ
212
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
95%
Success Rate