Rectangle.cpp: //Write a function that will overload the != operator of the Rect
ID: 3815350 • Letter: R
Question
Rectangle.cpp:
//Write a function that will overload the != operator of the Rectangle class.
//This function will return a a value of true to indicate that two rectangle are NOT the same size.
//Otherwise, the function will return false if the two rectangles ARE the same size.
//Note that the "==" overloaded operator has already been written for you.
//You must implement the overloaded != operator in such a way to allow the compiler to inline the function.
//You may NOT use the word INLINE for this.
Rectangle r4(200, 200);
Rectangle r5(200, 100);
cout << boolalpha << " r4 != r5 evaluates to " << (r4 != r5) << endl;*/
break;
}
Solve this in C++. Thank you!
E determine if two Rect angles are equal and return true otherwise return false bool Rectangle operator const Rectangle right const I bool isEqual false if (length right length & width right width) II (length right.width && width right lengt isEqual true return isEqualExplanation / Answer
bool Rectangle::operator!=(const Rectangle& other)const { return !(*this == other); }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.