Q:

When are friends useful? Discuss the pros and cons of using friends

0

When are friends useful? Discuss the pros and cons of using friends.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

A **friend** of a class can access non`public` members of that class.

Pros:

  - For functions that are part of the interface while not a member of the class, they can access the non`public` members of that class.

Cons:

  - If the implementation of the class changes over time, its friend may also requiring changes.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now