Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++: Create a class called ReferenceManager that will be used as a container to hold objects of classes Article, Book, and TextBook. ReferenceManager has a
C++:
Create a class called ReferenceManager that will be used as a container to hold objects of classes Article, Book, and TextBook.
- ReferenceManager has a fixed capacity. It uses a fixed size array to store References.
- The first reference added to the container will be added at position zero, the second one at position 1, and so on. A reference is always added at the next available position;
- A ReferenceManager has one regular constructor: ReferenceManager(int capacity). The constructor must create an array of size capacity, which will be used to store References. It will also initialize the instance variables that your implementation requires.
- ReferenceManager will have size data member, which will track the number of references in the array.
- bool add(Reference & reference): adds a reference at the next available position and returns true, or returns false if the reference manager is full.
- int get(int pos): returns the identifier of the Reference object stored at position pos of the ReferenceManager. You can assume that pos is a valid index, i.e. 0 <= pos < size;
- bool delete(int pos): removes the element at position pos of this ReferenceManager and returns true, or returns false if pos was not a valid index. It must also shift the elements of the array towards the beginning of the array;
- bool search(int id); return true if the reference with identifier id exists, false otherwise
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started