MathWorks Interview Question

What are friend functions?

Interview Answers

Anonymous

Dec 17, 2013

A function that is declared to be the 'friend' of a class will have access to its private and protected data.

1

Anonymous

Mar 22, 2016

In object-oriented programming, a friend function that is a "friend" of a given class is allowed access to private and protected data in that class that it would not normally be able to as if the data was public . Normally, a function that is defined outside of a class cannot access such information.