Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ I need help with this assignment..please??? 1. In this assignment, you will be using inheritance and polymorphism to implement a similar structure to

in c++ I need help with this assignment..please???

1. In this assignment, you will be using inheritance and polymorphism to implement a similar structure to the

drawing/shapeexample in the lecture. For this, you will need to design and write a base class and three

derived classes that inherit from the base (similar to theshapeclass and the derived shape classes). You will

also need a manager class that will hold a (fixed) array of pointers to your base type (similar to the

drawingclass from the notes).

2.The base class may or may not have any member variables itself, depending on your design. The derived

classes should have at least one member each to describe the structure/intent of that class.

3.You will provide onevirtualfunction in the base class that each derived class will override. The base class

virtual function should be purevirtual(a.k.a. abstract) unless the base does indeed have an

implementation. Each derived typesoverrideof the virtual function should cause some output tostd::cout

to indicate that it was invoked.

4. Each class should include a full set of constructors to initialize their member(s) as well as the base class.

Each derived class should call the base class constructor in their initialization lists if needed.

5. Your manager class will have an array of pointers to the base type that it manages and a method to add

objects (by pointer-to-base) into the array and track how many items have been added.

6. Include a function in the manager class that will loop through all of the objects in the array and invoke the

virtualfunction for each element (just likedrawing::drawlooped through all of itsshapes).

7. In yourmainfunction, instantiate a manager object.

8. Add several objects of your types to the manager object. These objects will have to be created dynamically

(withnew) and passed into the function you made in (5) that will add the objects to the array.

9. Call the manager objects function from (6) that will loop through all objects you just added.

10. Make sure that the managers constructor cleans up all of its objects when the manager object goes out of

scope.

11. Place all classes in their own headers (protecting against multiple inclusion) and in a namespace of your

own choosing, using separate.cppfiles for implementation if you choose

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago