Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this homework is get you familiar with inheritance, virtual functions, pure virtual functions, and heterogeneous containers. in C++ 1. You need to

The goal of this homework is get you familiar with inheritance, virtual functions, pure virtual functions, and heterogeneous containers. in C++

1. You need to design and implement a colorful Shape class with one pure virtual function computeArea(), two data members for the X and Y location of the object, one data member for the color (which can be black, white, or red), and one function printColor() that prints out the color.

2. You need to design and implement a Square class that needs to provide a concrete implementation of computeArea() and one additional data member for the edge length.

3. You need to design and implement a Circle class that needs to provide a concrete implementation of computeArea() and an additional data member for the radius.

4. In your main function, you need to design a heterogeneous container that holds 4 Square objects and 2 circle objects.

5. In your main function, you need to go through every element of the heterogeneous container and output their area sizes and colors.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions