Problem

Complete the following tasks:a. Create a base class named Rectangle that includes data mem...

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

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT