Hey guys!
Suppose i have a class named a.
a has a private variable b;
i have created a friend function in class a named hello(lets say),,which manipulates the private variable b,lets say it just makes b negative.
Now,i have created an object a1 of class a.
I know that a friend function is not exactly a member function of the class in which it is defined,but i also know that it can access the private members of a class.
I read a code somewhere,where they had passed a1 to hello by reference,and then manipulated the variable using the dot operator.Shouldnt we be able to manipulate a1 without using the dot operator ?by simply writing in the function b=-b;
Shouldnt the private variables be implicitly passed to the friend function?
Or will we have to go through the hassle of passing the object as an argument to a friend function everytime we need to manipulate its variables?