C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.9)


Which of the following cannot be friend?

[A]. Function
[B]. Class
[C]. Object
[D]. Operator function

Answer: Option C


No answer description available for this question.

Kiran said: (Jul 18, 2012)  
Class and functions can only be friend. Objects are instance of class, they cannot be defined by user as friend.

Surya Joy said: (Aug 11, 2012)  
Objects cannot be defined as friend by a user since it is just instance of a class.

Supreet Kaur said: (Jan 3, 2013)  
Friend function is a function which is not the member of the class but take part in class to pass arguments. Similarly a class can be a friend but an object cannot because it is an instance of the class.

Jyoti Shankar Chaubey said: (Mar 12, 2013)  
How you can say that operator function is a friend function?

Saba said: (May 4, 2013)  
How can operator function be a FRIEND FUNCTION?

Sanket said: (Jun 11, 2013)  
How can operator function be friend function?even I didn't get it?

K.Soundarya Rao said: (Jul 12, 2013)  
Any type of function can be made friendly exception-static. But object are the instance of class that cannot be made friend.

Amolbendale said: (Aug 22, 2013)  
How you can say that operator function is a friend function?

Kamal said: (Aug 29, 2013)  
What is operator function?

Nirmala said: (Feb 4, 2014)  
I don't know whether it is correct. The operator functions are used in the concept of operator overloading and type conversion. Operator can be overloaded as a member function or friend function. Therefore an operator function can be a friend function.

Arpit said: (Jul 26, 2014)  
Object is a variable of class type hence there is no sense to declare it as a friend. If it is declared as friend then where we use it think about it. Even if we make use of function as friend then it can be used to access other class private data.

Aravind said: (Aug 30, 2014)  
How is operator can be friend function explain in detail.

Sowmya said: (Sep 21, 2014)  
Explain the friend function?

Adity Pachory said: (Oct 3, 2014)  
Friend function is used to pass arguments in a class. Class can also be friend but an object is cannot be friend as it is an instance of a class.

Manjusha said: (Mar 7, 2015)  
What is mean by instance of a class?

Shubham said: (Aug 20, 2016)  
Instance of class means object works during the execution of program.

Aahan said: (Sep 30, 2016)  
Why not operator funtion?

Gyanendra Kumar Namdev said: (Dec 5, 2017)  
Thanks for the explanation.

Vivek Roy said: (Mar 16, 2020)  
We can define a friend function (i.e a normal function can be a friend of a class or a member function of a class can be a friend function of another class), friend class (i.e member function of a friend class can directly access private and public members of that class, if which it is defined as friend) and also friend operator function (i.e operator function of one class can be defined as friend function in another class). But object is a run time entity.

Tammana Karthikeya said: (Nov 6, 2020)  
Object cannot be defined as friend.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.