Question: Must be completed in C++ Complete the following tasks: a. Create a base class named Rectangle that includes data members for the length and width

Must be completed in C++

Complete the following tasks: a. Create a base class named Rectangle that includes data members for the length and width of a Rectangle, as well as functions to assign and display those values. Derive a class named Block that contains an additional data member to store height, and contains functions to assign and display the height. Write a main() function that demonstrates the classes by instantiating and displaying the values for both a Rectangle and a Block. Save the file as RectangleAndBlock.cpp.

b. Add a member function to the Rectangle class that computes the area of a Rectangle (length multiplied by width). Add a member function to Block that has the same name, but overrides the computation with a volume calculation (length by width by height). Write a main() function that demonstrates the classes. Save the file as RectangleAndBlock2.cpp

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!