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...



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.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here