Notes From CS Undergrad Courses FSU
This project is maintained by awa03
friend className function();
Friend functions have access to the private member data of the class they are contained within. This allows for the user to have a function separate from the class, but still interact with it.
className objectName = function(param);
We can call the friend function with the above syntax. Notice that no dot operator is used, this is because it is not explicitly part of the object, rather a separate function.
We also do not need to use scope resolution in order to define the friend function, within the implementation file.
int main(){
Fraction f = 9;
}
The definition of the conversion constructor will define what 9 means in this context