Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The lab has been designed for you to pructice implementing and testing overlesded operators for a enc. cheste pectangle x privatest unstgend width _ .
The lab has been designed for you to pructice implementing and testing overlesded operators for a enc.
cheste pectangle
privatest
unstgend width lengthi
pebuthe:
Recterentoli:
x
vopd setwidthunsigned:
voud sectengthi uns Conedi:
coputhe aneac const:
ptring tostring const:
The width, and length data members represent the width and length of a Rectangle shape.
You are given the following member functions:
The delault constructor sets the with and length of a new Rectangle object to and Fespectively.
A setwideh member function that takes cone parameter and updates the width of the involing Rectang le object using the value of the parameter.
A settength menber function that takes one parameter and updates the length of the invoking Rectanglo object using the value of the parameter.
An area member function rotums the area of the invoking fectangle object.
A tostring member function returns a string that indudes the wdith and length of the invoking Rectangle object
In part h you are asked wo overioid some operators for the Rectangle class using member functions. Make sure to write their prototyper in the "Rectangle the, implement them in the "Rectanglecpp" fle, and test them in the "main cpp ith"
Overtoad heeeperator to compare two Rectangle objects, it shall return true if the two rectunghe ore congruent and fake ottierwise. Two rectangles are congruent if they can hawe the firct rectingle is the same ac the length of the second and the length of the first is the same as the Widthol the cerond, For example, rectangle is cougruent with a rectangle. The tollowing tilutrates the rerults of cone cample tertang:
fitet rectingle: Mmanctore sy by
Goipare tint with secend true
Coppare sechen uth thind false Uniphed value. The folowing Hustates the foxuts of weme sumple terting.
instup
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started