Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I added the following functionality to my project but get an error message a

ID: 3648044 • Letter: H

Question

Hi,
I added the following functionality to my project but get an error message as follows (code is below) Thanks

Error 1 One of the parameters of a binary operator must be the containing type c:usersocdobbsdocuments isual studio 2010ProjectsConsoleApplication7ConsoleApplication7Program.cs 141 28 ConsoleApplication7

public static Fraction operator*(Fraction frac1, Fraction frac2)
{
int firstProduct1 = (frac1.WholeNumber * frac1.Numerator) + frac1.Numerator;
int secondProduct2 = (frac2.WholeNumber * frac2.Denominator) + frac2.Numerator;
int iNumerator=firstProduct1*secondProduct2;
int iDenominator = frac1.Denominator * frac2.Denominator;
return ( new Fraction(iNumerator,iDenominator));
}

Explanation / Answer

the error is in your method signature.. public static Fraction operator*(Fraction frac1, Fraction frac2) remove * between operator and paranthesis .. it will be solved :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote