Related questions with answers
Question
Find the error(s) in the following code:
class findErrors // Line 1
{ // Line 2
friend int operator*(const int &a,
const int &b); // Line 3
// Returns the object containing the
// product of the corresponding instance
// variables of the objects a and b of
// findError.
public: // Line 4
findErrors(int = 0, int = 0); // Line 5
private: // Line 6
int first; // Line 7
int second; // Line 8
}; // Line 9
double findErrors::operator*(const findErrors &a,
const findErrors &b) // Line 10
{ // Line 11
findErrors temp; // Line 12
temp.first = first * b.first; // Line 13
temp.second = second * b.second; // Line 14
return temp; // Line 15
} // Line 16
Solution
VerifiedAnswered 2 years ago
Answered 2 years ago
Step 1
1 of 3In friend int operator*(const int& a, const int& b);
, the return type as well as the parameters' type should be findErrors
, not int
.
Also, there should only be one parameter.
Create a free account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create a free account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Recommended textbook solutions

Fundamentals of Database Systems
7th Edition•ISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe948 solutions

Introduction to Algorithms
3rd Edition•ISBN: 9780262033848Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen872 solutions

Introduction to Algorithms
4th Edition•ISBN: 9780262046305Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen945 solutions

C++ Programming: From Problem Analysis to Program Design
8th Edition•ISBN: 9781337102087D. S. Malik1,889 solutions
More related questions
- calculus
1/4
- calculus
1/7