Computer Science, asked by AAFT53, 1 year ago

Which of the following statement is correct with respect to the use of friend keyword inside a class?

A.A private data member can be declared as a friend.
B.A class may be declared as a friend.
C.An object may be declared as a friend.
D.We can use friend keyword as a class name.

Answers

Answered by vikashRaojaat
0
A is correct..
..

.
.
.best friend is best
..

m
....
Answered by qwcricket10
0

The correct option is (B). A class may be declared as a friend.

  • The friend keyword allows the user to create a class as a friend of one class.
  • Thus the main class will automatically get access to the class defined using the friend keyword.
  • Thus the friend keyword builds the link between two classes.
  • The use of the friend keyword inside a class is to declare another class as its friend.
  • Option(B) is correct.
Similar questions