Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The friend functions are stored in a Host class....we are trying to use those functions stored in the Host. That means another function in Host

image text in transcribed
The "friend" functions are stored in a "Host" class....we are trying to use those functions stored in the Host. That means another function in "Host" to convert "alien" Friend class objects into "temporary Host" objects!!
This exercise is about the "mechanics" and syntax of one or more alien "friends" being allowed to use shared functions stored in a "Host" class.
image text in transcribed
Class - Friend Functions Class members can access other functions outside of their own member functions called "friend" functions. 1. Create a class with the following member variables and functions: a, Initialize the member variables nl and n2 b. Add two numbers and return the sum (nl + n2) c. Subtract two numbers and return the difference (nl d. Multiply two numbers and return the product (nl * n2) e. Divide two numbers and return the dividend (nl 2) If n2 is zero, set n2 to 1. 2. The class has several friend functions: a. Average - pass the class object and return the average of nl and n2 b. Comparel - pass the class object and return the Larger of nl and n2. Ifnl and n2 are equal zero to signal that n1 and n2 are equal c. Compare2 - pass the class object and return the Smaller of nl and n2. If nl and n2 are equal zero to signal that nl and n2 are equal 3. Allow the user to run this as many times as they wish during the application's execution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Balance the following redox equations by the ion electron method:

Answered: 1 week ago