You have a base class called Shape such as: #include #include using namespace std; class Shape { protected: int sidel, side2; public: Shape (int a, int b) { sidel = a, side2 = b; } void set_values...

You have a base class called Shape such as: #include #include using namespace std; class Shape { protected: int sidel, side2; public: Shape (int a, int b) { sidel = a, side2 = b; } void set_values (int a, int b){ sidel = a; side2 - b;} }; Solve the following items: 1- Derive the Rectangle and Square classes from base class. 2- Calculate area for each one. 3- Display all results using virtual function called showResults(). 4- What is the type of the inheritance used in the program. 5- Test all the functions in your program by implementing them. Hint: - Add any functions or data you need that are suitable for your code.Q3) You have a base class called Shape such as:<br>#include <iostream><br>#include <conio.h><br>using namespace std;<br>class Shape {<br>protected:<br>int side1, side2;<br>public:<br>Shape (int a, int b) {<br>sidel = a, side2 = b;<br>}<br>void set_values (int a, int b){<br>sidel = a; side2 = b;}<br>};<br>Solve the following items:<br>1- Derive the Rectangle and Square classes from base class.<br>2- Calculate area for each one.<br>3- Display all results using virtual function called showResults().<br>4- What is the type of the inheritance used in the program.<br>5- Test all the functions in your program by implementing them.<br>Hint: - Add any functions or data you need that are suitable for your code.<br>

Extracted text: Q3) You have a base class called Shape such as: #include #include using namespace std; class Shape { protected: int side1, side2; public: Shape (int a, int b) { sidel = a, side2 = b; } void set_values (int a, int b){ sidel = a; side2 = b;} }; Solve the following items: 1- Derive the Rectangle and Square classes from base class. 2- Calculate area for each one. 3- Display all results using virtual function called showResults(). 4- What is the type of the inheritance used in the program. 5- Test all the functions in your program by implementing them. Hint: - Add any functions or data you need that are suitable for your code.
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here