C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 9)
9.
Which of the following cannot be friend?
Function
Class
Object
Operator function
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
21 comments Page 1 of 3.

Vivek Roy said:   5 years ago
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.
(7)

Nirmala said:   1 decade ago
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:   1 decade ago
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.

Supreet kaur said:   1 decade ago
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.

Adity pachory said:   1 decade ago
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.

K.soundarya rao said:   1 decade ago
Any type of function can be made friendly exception-static. But object are the instance of class that cannot be made friend.

Kiran said:   1 decade ago
Class and functions can only be friend. Objects are instance of class, they cannot be defined by user as friend.

Surya joy said:   1 decade ago
Objects cannot be defined as friend by a user since it is just instance of a class.

Shubham said:   9 years ago
Instance of class means object works during the execution of program.

Sanket said:   1 decade ago
How can operator function be friend function?even I didn't get it?


Post your comments here:

Your comments will be displayed after verification.