Differentiating friend functions and static functions


Question 1)a) Compare the three access specifiers; Public, Private, and Protected. What are the main advantages and disadvantages of these access specifiers?

(b) Describe the following tem multiple inheritance with the help of at least two different examples.

Question 2)(a) What do you mean by Operator Overloading? Describe it in detail with the help of appropriate examples.

(b) What are the main differences between Friend Functions and Static Functions? Describe them in detail.

Question 3) In a loop, prompt the user to enter name data consisting of a first name, middle initial, last name, and employee number (type unsigned long). Then, using formatted I/O with the insertion (<<) operator, write these four data items to an of stream object. Do not forget that strings must be terminated with a space or other whitespace character. When the user indicates that no more name data will be entered, close the of stream object, open an ifstream object, read and display all the data in the file, and terminate the program.

Question 4)(a) What do you mean by throwing an exception? What is the sequence of events when an exception occurs?

(b) Write a template function which returns average of all the elements of an array. Arguments to the function must be an array name and the size of the array (type int). In main ( ), exercise function with arrays of type int, long, double, and char.

Question 5) Write a note on the following terms:

• Error Handling

• Virtual Destructors

• Command Line Arguments

• Simple and Multiple Exceptions

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Differentiating friend functions and static functions
Reference No:- TGS06023

Expected delivery within 24 Hours