Question: Please solve using C++ A friend function is a function that is not a member of a class, but has access to privato members of

Please solve using C++ A friend function is a function that is not a member of a class, but has access to privato members of the class. A friend function can be a stand-alone tun ction or a member function of another class. This task demonstrates examples of friend stand-alone functions. Write the definition of a class named Circle that has the followings: A private data member radius of type double. A default constructor that assigns the value 1 to radius. A friend function named setRadius that accepts a Circle object by reference as first argument, and a double as second argument then assigns it to the radius of the Circle argument. A friend function named getArea that accepts a Circle as an argument, then uses the radius of that argument to calculate its area and return it. Use 3, 14159 as an approximate value of PI (m)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!