Question: Can someone please help? it should be written in C++. it should have 7 separate files: shape.h and shape.cpp; triangle.h and triangle.cpp; rectangle.h and rectangle.cpp

Can someone please help? it should be written in C++. it should have 7 separate files: shape.h and shape.cpp; triangle.h and triangle.cpp; rectangle.h and rectangle.cpp and the main function.

Can someone please help? it should be written in C++. it should

1. Define a base class called Shape containing: - a constructor, - two protected variables: double length, double height, and - a pure virtual function getArea() with a return type of double. Define two derived classes Rectangle and Triangle, that implements the getArea() function to return the appropriate area values. Ensure that the derived classes contain constructors. Define a main that creates a Rectangle type object and a Triangle type object, assigns appropriate length and height values to evaluate the area and show as outputs. You may use the set and get methods as needed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!