Question: I need to create a C++ Class that does what is outlined within the question. Please make sure to ready carefully and provide explanations on

I need to create a C++ Class that does what is outlined within the question. Please make sure to ready carefully and provide explanations on the code written. And please do not copy the answer from elsewhere. I want a detailed answer. Thank you in advance.

I need to create a C++ Class that does what is outlined

1.1 You are asked to implement a C++ class to model an array of bits of arbitrary size. The idea is that we want to store n bits and want to make sure that we do not waste storage and each bit occupies exactly one bit of memory. This is because the class is to be used in an embedded application that cannot assume the presence of the STL and must also use the smallest amount of storage possible. Your class should offer an API that enables looking up and setting the value of a bit (for example, x.getValue(25) would return the value of the 25th bit, and x.setValue (25,1) would set its value to 1 ). You should also provide appropriate constructors, destructor, and member function printArray which prints only bit indices which have the value of 1. You are also asked to implement a main program that uses your class demonstrate the above interfaces and functionality. 1.2 You are asked to build on your work in (1.1) to provide the index operator ([ ]) to enable accessing specific bits in your array. For example, to enable code like: Please provide a test program to demonstrate that your class and operators behaves as expected and handles errors in an appropriate manner

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!