C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - General Questions (Q.No. 2)
2.
Which of the following statements is incorrect?
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().
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
21 comments Page 2 of 3.

Malayor said:   3 years ago
The friend keyword cannot be used because it is a correct keyword c++ can code correct keywords only. So, c++ cannot code the friend keyword.

Yogesh said:   10 years ago
Friend function is not a member function of class, friend function is declared inside the class but it is defined outside the class.

Durgadevi said:   1 decade ago
Because friend keyword does not declared in main() function only we use under the class.

Sweety said:   1 decade ago
friend keyword can be used on main() also i.e we can make main() as friend function.

Parth khandelwal said:   10 years ago
Friend function is used to access private data members of one class to another.
(1)

Harmandeep kaur said:   9 years ago
I thought the Friend function is used to access private members of any class.

Ananya said:   1 decade ago
Friend keyword can be used on main() ? please explain I didn't get ?

Thivakar R said:   1 decade ago
Friend function only initialize in-between main and class.

Seema said:   1 decade ago
Please explain why friend keyword is not used with main()?

Rohit patil said:   10 years ago
Wrong answer.

Friend is only used in class not in main.
(1)


Post your comments here:

Your comments will be displayed after verification.