Answer the following questions true (T) or false (F)

1. A friend function has access only to the private members and member functions of the class (and all objects of that class) of which it is a friend.

2. A class can have friends that are functions as well as friend classes.

1. False
Explanation: A friend function, like every other function, has access to any public members of any class, the class of which it is a friend included. Friendship gives the function access to all public and private members.
2. True
Explanation: A friend function has access to all members of the class of which it is a friend. When a class A is a friend of class B, then every member of class A is a friend function of class B. This grants full access to class B’s members to all function members of class A.

Computer Science & Information Technology

You might also like to view...

What are the two methods of programming with Access?

What will be an ideal response?

Computer Science & Information Technology

Which of the following wireless standards operate at a maximum bandwidth of less than 20 Mbps? (Choose two.)

A) 802.11 B) 802.11a C) 802.11b D) 802.11g

Computer Science & Information Technology