Computer Science, asked by sumiti29, 1 month ago

2. Which of the following statements is incorrect?
(1 Point)
Friend keyword can be used in the class to allow access to another class.
Friend keyword can be used for a function in the public section of a class.
Friend keyword can be used for a function in the private section of a class.
Friend keyword can be used on main().

Answers

Answered by gangasulane
0

Answer:

option d is correct

Explanation:

Friend keyword can be used on main.

Answered by ankhidassarma9
1

Answer:

Friend keyword can be used on main().

Explanation:

  • The member functions of a class can all be made friends at the same time if we make entire class a friend class. If in class  Alpha the entire class Beta is proclaimed a Friend then all member function of Beta can access the private data of Alpha.
  • Friend keyword can be used for a function in the public section as well as in the private section of a class. A friend function is not on the scope of a class of which it is a friend.
  • This function is not invoked using the class object. So the declaration can placed anywhere in the class but can't be used in the main function as friend function act as a bridge between Two class.

Similar questions