Thursday, July 8, 2010

Use of Friend Function

,
Friend Function is a very nice feature of C++. You know that when we write a programme in c ++ we also use class. We also define members of classes which are accessible or not. In this post we'll discuss what is friend function, what the use of friend function, and how to use of friend function.

1. What is friend function

What function is ordinary function and another feature of C++. Which is very useful when we use Private or Public classes both.

2. What the use of friend function

Some Time we write programme in C++ and declare some member private and some public but in case we another class which not derived to main class and we need to use member of main class then friend function provide a facility to access private member in any class.

3. How to use friend function

It's easy to use and not complex we just declare this function with keyword of friend






1 comments: