Question: To use the applyMarks() function as a friend function to both Test and assignment classes, you must declare the applyMarks() as a friend function within
To use the applyMarks() function as a friend function to both Test and assignment classes, you must declare the applyMarks() as a friend function within each class. The function prototype for applyMarks() is: friend void applyMarks(Tests, assignment); The function prototype refers to both Test and assignment classes as parameters. However, if you place the Test class definition first in the file, and then declare applyMarks() friend function within the Test class definition, the assignment class has not yet been defined. If you place the assignment definition first, and then declare applyMarks() friend function within the assignment definition, the Test class has not yet been defined. Either way, one of the class definition makes reference to an undefined class, causing an error because in C++ variables, functions, and classes must be declared before they can be used.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
