Question: 1 - Implement a header and implementation file for class Rectangle. Rectangle should include a single integer data member length, a constructor, an accessor, a
Implement a header and implementation file for class Rectangle. Rectangle
should include a single integer data member length, a constructor, an accessor,
a mutator and a member print function. Be sure to include preprocessor
directives and include statements as needed.
driver.cpp
#include
#include "Square.h
int main
YCercioglu
std:: cout
;
Instantiate an object of type Square with a side length of
Square mySquare;
mySquare.setSide;
Print the initial state of the square
std::cout "Initial state of the square:" std::endl;
printmySquare;
Using accessor function to get the side length of the square
std::cout "The side length of the square is: mySquare.getSide std::endl;
Using the mutator function to change the side length of the square to
mySquare.setSide;
std::cout "The side length of the square is: mySquare.getSide std::endl;
Printing the state of the square after modifying its side length
std::cout "State of the square after changing its side length:" std::endl;
printmySquare;
return ;
Update driver.cpp to instantiate an object of type Rectangle and test all
Rectangle functions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
