using c++ oop !!! kindly need help asap. Implement the shape, rectangle, and square classes with components as shown and the following functionality: Each constructor and destructor prints a message to the screen that it is being called in each class implement the area() method that calculates the area of the figure (for the Shape class you can return 0) Example Constructor shape: Rectanleeeeeee Rectangle constructor 232.5 Rectanleeeeeee Eeeeeeee Rectangle destructor Shape destructor Constructor shape: Squareeeee Rectangle constructor Square constructor Squareeeee AAAaaaa 105.165 Square destructor Rectangle destructor Shape destructor // main.cpp : Defines the entry point for the application. // #include "main.h" using namespace std; int main(void) { { rectangle rec("Rectanleeeeeee", 10, 23.25); std::cout << rec.area() << std::endl; std::cout << rec.get_name() << std::endl; rec.set_name("Eeeeeeee"); std::cout << rec.get_name() << std::endl; } { square squ("Squareeeee", 10.255); std::cout << squ.get_name() << std::endl; squ.set_name("AAAaaaa"); std::cout << squ.get_name() << std::endl; std::cout << squ.area() << std::endl; } }
using c++ oop !!! kindly need help asap.
Implement the shape, rectangle, and square classes with components as shown and the following functionality:
- Each constructor and destructor prints a message to the screen that it is being called
- in each class implement the area() method that calculates the area of the figure (for the Shape class you can return 0)
Example
Constructor shape: Rectanleeeeeee Rectangle constructor 232.5 Rectanleeeeeee Eeeeeeee Rectangle destructor Shape destructor Constructor shape: Squareeeee Rectangle constructor Square constructor Squareeeee AAAaaaa 105.165 Square destructor Rectangle destructor Shape destructor
// main.cpp : Defines the entry point for the application.
//
#include "main.h"
using namespace std;
int main(void) {
{
rectangle rec("Rectanleeeeeee", 10, 23.25);
std::cout << rec.area() << std::endl;
std::cout << rec.get_name() << std::endl;
rec.set_name("Eeeeeeee");
std::cout << rec.get_name() << std::endl;
}
{
square squ("Squareeeee", 10.255);
std::cout << squ.get_name() << std::endl;
squ.set_name("AAAaaaa");
std::cout << squ.get_name() << std::endl;
std::cout << squ.area() << std::endl;
}
}
Step by step
Solved in 2 steps with 1 images